current location:Home > Technical Articles > Backend Development > C#.Net Tutorial
- Direction:
- All web3.0 Backend Development Web Front-end Database Operation and Maintenance Development Tools PHP Framework Daily Programming WeChat Applet Common Problem Other Tech CMS Tutorial Java System Tutorial Computer Tutorials Hardware Tutorial Mobile Tutorial Software Tutorial Mobile Game Tutorial
- Classify:
-
- 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#?
- 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
- 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#?
- 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#
- 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?
- 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#?
- 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#
- 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#?
- 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#?
- 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#
- 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#?
- 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?
- 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
- 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#
- 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