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:
-
- StringWriter vs. StringReader in C#?
- StringReader and StringWriter are derived from TextReader and TextWriter. StringWriter is used for writing to string buffers. It implements a TextWriter for writing information to a string. For StringWriter - example StringWritersWriter=newStringWriter();while(true){ myChar=strReader.Read(); if(myChar==-1)break
- C#.Net Tutorial 912 2023-09-15 16:17:02
-
- Why do indexes in C# arrays start from zero?
- An array is a pointer to an address in index memory. The index is the first element of the array. Here, the index is like an offset, a concept that even predates the origin of the C language. Suppose your array elements start from 0Xff000 and have 5 elements, such as {35,23,67,88,90}. So the array in memory will look like below since int is stored using 4 bytes. 0Xff000has350Xff004has230Xff008has670Xff012has880Xff016has90 This means when accessing the array, zero offset will be index 0. Let us further understand the concept of zero indexing in C# - if an array is empty, it has 0 elements and has a length of 0.
- C#.Net Tutorial 1589 2023-09-15 14:57:03
-
- What are the important namespaces in C#? Provide a brief description of each
- .NET contains a large number of namespaces, and even more if you include third-party libraries. However, there are some that you will use again and again. Here are 20 that can help you solve 80% of common, recurring programming problems. The system contains the most basic types. These include commonly used classes, structures, enumerations, events, interfaces, etc. System.Text contains classes representing ASCII and Unicode character encodings. Class for converting between blocks of characters and blocks of bytes. System.Text.RegularExpressions provides regular expression functionality. System.Linq provides classes and interfaces that support queries using Language Integrated Query (LINQ). System.XM
- C#.Net Tutorial 709 2023-09-15 13:53:21
-
- Print using your own fonts using C#
- To print your own font in C#, first construct a -FontFamily object. Font object. The FontFamily object sets fonts such as Arial, TimesNewRoman, etc., and the Font object sets the size and style of the font. Let's create an Arial font style. FontFamilymyFontFamily=newFontFamily("Arial");FontmyFont=newFont(myFontFamily,20,FontStyle.Bold,GraphicsUnit.Pixel); Above, we set FontFamily
- C#.Net Tutorial 1053 2023-09-15 12:29:09
-
- What are the various JSON files available in C# ASP.NET Core?
- ASP.netCore is re-architected from previous ASP.net versions, including configuration dependencies on System.Configuration and xml configuration in the web.config file. In ASP.netCore, a new easy way solution to declare and access global settings, project specific settings, client specific settings and more. New configuration model for XML, INI and JSON files. Different configuration JSON files in ASP.netCore There are mainly 6 configuration JSON files in ASP.netCore. global.jsonlaunchsettings.jsonappsettings.j
- C#.Net Tutorial 891 2023-09-15 12:29:05
-
- C# program to convert Fahrenheit to Celsius
- First, set the temperature in Fahrenheit - doublefahrenheit=97; Console.WriteLine("Fahrenheit:"+fahrenheit); Now convert it to Celsius - celsius=(fahrenheit-32)*5/9; Example You can try running the following code to convert Fahrenheit to Fahrenheit Convert temperature to degrees Celsius. Live demonstration usingSystem;usingSystem.Collections.Generic;usingSystem.Linq;usingSystem.Text;namespaceDemo{&n
- C#.Net Tutorial 1220 2023-09-15 11:53:09
-
- Thread pool in C#
- A thread pool in C# is a collection of threads. It is used to perform tasks in the background. When a thread completes its task, it is sent to the queue where all waiting threads exist. This is done so that it can be reused. Let's see how to create a thread pool. First, use the following namespace - usingSystem.Threading; now, call the thread pool class using the thread pool object. Call the QueueUserWorkItem method - ThreadPool.QueueUserWorkItem(newWaitCallback(Run)); iterate over it in a loop and compare it with a normal Thread object.
- C#.Net Tutorial 1198 2023-09-15 11:37:02
-
- Join, Sleep and Abort methods in C# threads
- Join blocks the calling thread until the thread terminates, while continuing to perform standard COM and SendMessage pumping. This method has different overloaded forms. Sleep causes the thread to pause for a period of time. AbortAbort method is used to destroy threads. Let's look at an example of Join() in a thread - example usingSystem;usingSystem.Diagnostics;usingSystem.Threading;namespaceSample{ classDemo{ static
- C#.Net Tutorial 1609 2023-09-15 11:01:09
-
- What is the C# equivalent of the friend keyword in C++?
- The friend function of a friend class in C# is defined outside the scope of the class, but it has access to all private and protected members of the class. Although the prototype of a friend function appears in the class definition, a friend is not a member function. A friend can be a function, function template, or member function, or it can be a class or class template, in which case the entire class and all its members are friends. The closest equivalent in C++ to a friend in C# is to create a nested class that will access the private members of the outer class. Here, the inner class can access the private members of the outer class - classOuter{ classInner{ }}
- C#.Net Tutorial 739 2023-09-15 10:53:02
-
- Access modifiers in C#
- Access modifiers specify the scope of variables and functions in C#. The following are the access modifiers provided by C#: The Public modifier places no restrictions on member access. Protected access is limited to derived classes or class definitions. Its declaration is accessed by internal access modifiers within a program with the following permissions. protected internal It has access specifiers provided by both protected and internal access modifiers. Private only within the class in which it is declared. Members designated as private cannot be accessed outside the class. Example Let's look at an example of protected access modifier, accessing protected members - live demonstration usingSystem;namespaceMySpecifiers{&nbs
- C#.Net Tutorial 940 2023-09-15 08:37:02
-
- What is the overloading capability of operators in C#
- The following is a list of operators that can be overloaded in C#, and the operators that cannot be overloaded. Ordinal operators and descriptions 1+,-,!,~,++,--These unary operators accept one operand and can be overloaded. 2+,-,*,/,% These binary operators accept two operands and can be overloaded. 3==,!=,,= comparison operators can be overloaded. 4&&, || conditional logical operators cannot be directly overloaded. 5+=,-=,*=,/=,%= assignment operators cannot be overloaded. 6=,.,?:,-
- C#.Net Tutorial 1264 2023-09-15 08:13:08
-
- What are the if/then directives in C# for debugging and publishing?
- There are different configurations for building your .Net project in Visual Studio debug mode and release mode. Select Debug mode to step through your .Net project, then select Release mode where the assembly file (.dll or .exe) is finally built. To change the build configuration - From the Build menu, select Configuration Manager, then Debug or Release. Or on the toolbar, select Debug or Release from the solution configuration. Code written in #ifdebug will only be executed if run in debug mode. If the code is running in release mode, #ifDebug will be false and the code present within it will not be executed. Example classProgram{
- C#.Net Tutorial 1236 2023-09-14 22:29:08
-
- Abstract classes, sealed classes and class members in C#
- Abstract classes include abstract methods and non-abstract methods. Abstract classes cannot be instantiated. A sealed class prevents inheritance and cannot be used as a base class. Abstract Class To declare an abstract class, you need to put the keyword abstract before the class definition. An example of a class member in an abstract class is as follows, an abstract method is defined - publicabstractclassVehicle{ publicabstractvoiddisplay();} The abstract method definition is followed by a semicolon because it is not implemented. Sealed class To declare a sealed class, you need to place the keyword seal class definition in front. A sealed class prevents inheritance, and you cannot use it as a base class. publicse
- C#.Net Tutorial 845 2023-09-14 22:21:06
-
- How to find the number of CPU cores in C#?
- We can get a variety of different information related to the processor. The number of physical processors, the number of cores, and the number of logical processors. These can all be different; taking a machine with 2 dual-core hyperthreading enabled as an example of a processor, there are 2 physical processors, 4 cores and 8 logical processors. The number of logical processors is available through the Environment class, but other information is only available through WMI (and you may need to install some hotfixes or service packs on some systems for this to work) − Add the following to your project Reference to System.Management.dll. In .NET Core, this is provided as a NuGet package (Windows only). thing
- C#.Net Tutorial 1281 2023-09-14 22:21:02
-
- What are destructors in C# 7.0?
- C# allows multiple destructor methods to be used in the same program with the same number of output parameters or the same number and type of output parameters in a different order. It's part of the new tuple syntax - not related to the Tuple class, but taken from functional programming. Deconstruct keyword is used for destructuring function example publicclassEmployee{ publicEmployee(stringemployeename,stringfirstName,stringlastName){ Employeename
- C#.Net Tutorial 1154 2023-09-14 22:05:03