current location:Home > Technical Articles > Backend Development > C#.Net Tutorial

  • C# equivalent of Java's double bracket initialization?
    C# equivalent of Java's double bracket initialization?
    Java's double bracket initialization accomplishes the same job as single bracket initialization in C#. Double brackets create and initialize objects within a single Java expression. Let us say the following is in Java - Example List<String>list=newList<String>(){{ add("One"); add("Two"); add("Three");
    C#.Net Tutorial 870 2023-09-07 14:01:05
  • What is managed code in C#?
    What is managed code in C#?
    Managed code is code whose execution is managed by the common language runtime (CLR). It takes managed code and compiles it into machine code. After that, the code is executed. The runtime here is the CLR, which provides automatic memory management, type safety and other functions. Managed code is written in a high-level language and runs on .NET. It can be C#, F#, etc. Code compiled using their compiler does not produce machine code. However, you will get intermediate language code, compiled and executed by the runtime. C/C++ code is called "unmanaged code" and it does not have this privilege. It is the responsibility of the operating system to load programs into memory in binary form. Programmers need to handle the rest themselves. C++ can also generate unmanaged binaries that run on Windows
    C#.Net Tutorial 1444 2023-09-07 10:53:02
  • C# program estimates folder size
    C# program estimates folder size
    Introduction In this article, we will look at a C# program to estimate folder size. On our computers, we store files in directories called folders. We will also see how to estimate the size of the folders present in the files. Merely calculating the file size is not sufficient to achieve our goals. Instead, we also need to calculate the size of folders and subfolders. The following article will explain how to calculate the size of a folder in three parts. The first part we need to know is the GetFolderSize method, which will give us the size of the folder. The second part is the FormatBytes method, which converts the size into a human-readable format. We will also briefly look at different approaches, which will be crucial for the further development of this article. Method we will
    C#.Net Tutorial 1092 2023-09-07 10:33:02
  • What are unary operators in C#?
    What are unary operators in C#?
    The following are the unary operators in C# -+-!~++--(type)*&sizeof Let us understand the sizeof operator. sizeof returns the size of the data type. Suppose you need to find the size of int data type - sizeof(int) For double data type - sizeof(double) Let's see the complete example to find the size of various data types - Example Live Demonstration usingSystem;namespaceDemo{ classProgram{ staticvo
    C#.Net Tutorial 1483 2023-09-07 10:05:02
  • Covariance and contravariance in C#
    Covariance and contravariance in C#
    To handle classes efficiently, use the concepts of covariance and inverse variance. Let's consider the following as our course. One is the base class for class two, and two is the base class for class three. classOne{}classTwo:One{}classThree:Two{} A base class can contain derived classes, but the reverse is not possible. Covariance allows you to pass a derived type where a base type is expected. Covariance can be used with arrays, interfaces, delegates, etc. in C#. The contrast variance is parameter-specific. Allows methods with base class parameters to be assigned to delegates that require derived class parameters with contravariance.
    C#.Net Tutorial 906 2023-09-07 09:05:02
  • How to enable sessions in C# ASP.NET Core?
    How to enable sessions in C# ASP.NET Core?
    Session is a feature in ASP.NETCore that enables us to save/store user data. Session stores data in a dictionary on the server, using SessionId as the key. The SessionId is stored in a cookie on the client side. The SessionId cookie is sent with every request. The SessionId cookie is per-browser and cannot be shared between different browsers. The SessionId cookie has no timeout specified and is deleted when the browser is closed and the browser session ends. On the server side, sessions are retained for a limited time. The default session timeout for the server is 20 minutes,
    C#.Net Tutorial 664 2023-09-07 08:41:05
  • What is the difference between public, static and void keywords in C#?
    What is the difference between public, static and void keywords in C#?
    All these keywords are part of the main method of any C# program. The Main method is the entry point of all C# programs and describes what the class does when executed. >usingSystem;classDemo{ staticvoidMain(string[]args){ Console.WriteLine("MyfirstprograminC#!"); }}public-This is the access specifier
    C#.Net Tutorial 1779 2023-11-21 16:47:35
  • Final variables in C#
    Final variables in C#
    Java has the final keyword, but C# has no implementation of it. The same implementation is achieved using seal or readonly keyword in C#. readonly allows a variable to be assigned a value only once. Fields marked "read-only" can only be set once during object construction. It cannot be changed. Example classEmployee{ readonlyintage; Employee(intage){ this.age=age; &
    C#.Net Tutorial 793 2023-09-06 22:41:12
  • How to display the IP address of a machine using C#?
    How to display the IP address of a machine using C#?
    Use the IPHostEntry.AddressList property to get the IP address - IPHostEntrymyIP=Dns.GetHostEntry(hostName);IPAddress[]address=myIP.AddressList; Try the following code to display the IP address - Example usingSystem;usingSystem.Net;classProgram{ staticvoidMain(){ StringhostNam
    C#.Net Tutorial 811 2023-09-06 22:25:02
  • What is overloading in C#?
    What is overloading in C#?
    C# provides two technologies to achieve static polymorphism - function overloading, operator overloading, function overloading, two or more methods with the same name but different parameters, which are our function overloading in C#. Function overloading in C# can be achieved by changing the number of parameters and the data type of the parameters. Suppose you have a function that prints the multiplication of numbers, then our overloaded methods will have the same name but a different number of arguments - publicstaticintmulDisplay(intone,inttwo){}publicstaticintmulDisplay(intone,inttwo,intthree){}publicstaticintmulDisplay
    C#.Net Tutorial 860 2023-09-06 22:17:02
  • Events and delegates in C#
    Events and delegates in C#
    C# events are used to solve troubles in delegates. One of them can easily override delegate properties, which can eventually lead to bugs in your code. To avoid this, C# uses events and defines wrappers around delegates. Events in C# To use events, you should first define a delegate. An event is a delegate type, pressing a key is an example of an event. publicdelegatevoideDemo(Stringval);publiceventTestTestEvent;Events can hold delegates like this. this.TestEvent+=newDemo(DemoData); The delegate in C# is a reference type variable that holds a reference to the method. Can
    C#.Net Tutorial 1333 2023-09-06 20:33:15
  • What is shallow copy and how is it different from deep copy in C#?
    What is shallow copy and how is it different from deep copy in C#?
    Shallow copy − Shallow copy refers to copying the "main" part of an object, but not copying the inner objects. The "inner objects" are shared between the original object and its copy. The problem with the shallow copy is that the two objects are not independent. If you modify one object, the changes will be reflected in the other object. deep copy − deep copy is a
    C#.Net Tutorial 621 2023-09-06 19:41:09
  • How to declare member functions in C# interface?
    How to declare member functions in C# interface?
    Declare the member functions of the interface in C# −publicinterfaceInterfaceName{ //interfacemembers voidInterfaceMemberOne(); doubleInterfaceMembeTwo(); voidInterfaceMemberThree()}publicclassClassName:
    C#.Net Tutorial 1050 2023-09-06 19:37:02
  • Enqueue and deque in C# Queue class
    Enqueue and deque in C# Queue class
    The queue collection class is a concept in C# and is included in the System.Collection namespace. Elements are stored in a FIFO queue. The first element added will be the first one out, like people queuing up outside a movie theater to buy tickets. It has two methods. The Enqueue() method adds a value and the Dequeue() method for retrieving a value adds an item to the queue. Queueq=newQueue();q.Enqueue("Two");q.Enqueue("One"); Dequeue returns items from the queue. Queueq=newQueue();q.Enqueue(“Two”);q.Enqueue(“One
    C#.Net Tutorial 1383 2023-09-06 19:09:10
  • StringCollection class in C#
    StringCollection class in C#
    The StringCollection class represents a collection of strings. The following are the properties of the StringCollection class -Sr.no property and description 1Count gets the number of key/value pairs contained in the OrderedDictionary collection. 2IsReadOnly gets a value indicating whether the StringCollection is read-only. 3IsSynchronized gets a value indicating whether access to the StringCollection is synchronized (thread-safe). 4Item[Int32] gets or sets the element at the specified index. 5SyncRoot get can be used to synchronize StringCollect
    C#.Net Tutorial 1264 2023-09-06 18:49:02

Tool Recommendations

jQuery enterprise message form contact code

jQuery enterprise message form contact code is a simple and practical enterprise message form and contact us introduction page code.
form button
2024-02-29

HTML5 MP3 music box playback effects

HTML5 MP3 music box playback special effect is an mp3 music player based on HTML5 css3 to create cute music box emoticons and click the switch button.

HTML5 cool particle animation navigation menu special effects

HTML5 cool particle animation navigation menu special effect is a special effect that changes color when the navigation menu is hovered by the mouse.
Menu navigation
2024-02-29

jQuery visual form drag and drop editing code

jQuery visual form drag and drop editing code is a visual form based on jQuery and bootstrap framework.
form button
2024-02-29

Organic fruit and vegetable supplier web template Bootstrap5

An organic fruit and vegetable supplier web template-Bootstrap5
Bootstrap template
2023-02-03

Bootstrap3 multifunctional data information background management responsive web page template-Novus

Bootstrap3 multifunctional data information background management responsive web page template-Novus
backend template
2023-02-02

Real estate resource service platform web page template Bootstrap5

Real estate resource service platform web page template Bootstrap5
Bootstrap template
2023-02-02

Simple resume information web template Bootstrap4

Simple resume information web template Bootstrap4
Bootstrap template
2023-02-02

Cute summer elements vector material (EPS PNG)

This is a cute summer element vector material, including the sun, sun hat, coconut tree, bikini, airplane, watermelon, ice cream, ice cream, cold drink, swimming ring, flip-flops, pineapple, conch, shell, starfish, crab, Lemons, sunscreen, sunglasses, etc., the materials are provided in EPS and PNG formats, including JPG previews.
PNG material
2024-05-09

Four red 2023 graduation badges vector material (AI EPS PNG)

This is a red 2023 graduation badge vector material, four in total, available in AI, EPS and PNG formats, including JPG preview.
PNG material
2024-02-29

Singing bird and cart filled with flowers design spring banner vector material (AI EPS)

This is a spring banner vector material designed with singing birds and a cart full of flowers. It is available in AI and EPS formats, including JPG preview.
banner picture
2024-02-29

Golden graduation cap vector material (EPS PNG)

This is a golden graduation cap vector material, available in EPS and PNG formats, including JPG preview.
PNG material
2024-02-27

Home Decor Cleaning and Repair Service Company Website Template

Home Decoration Cleaning and Maintenance Service Company Website Template is a website template download suitable for promotional websites that provide home decoration, cleaning, maintenance and other service organizations. Tip: This template calls the Google font library, and the page may open slowly.
Front-end template
2024-05-09

Fresh color personal resume guide page template

Fresh color matching personal job application resume guide page template is a personal job search resume work display guide page web template download suitable for fresh color matching style. Tip: This template calls the Google font library, and the page may open slowly.
Front-end template
2024-02-29

Designer Creative Job Resume Web Template

Designer Creative Job Resume Web Template is a downloadable web template for personal job resume display suitable for various designer positions. Tip: This template calls the Google font library, and the page may open slowly.
Front-end template
2024-02-28

Modern engineering construction company website template

The modern engineering and construction company website template is a downloadable website template suitable for promotion of the engineering and construction service industry. Tip: This template calls the Google font library, and the page may open slowly.
Front-end template
2024-02-28