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:
-
- What are Lambda expressions in C#?
- Lambda expressions are a better way to represent anonymous methods. Both anonymous methods and lambda expressions allow you to define method implementations inline, however, anonymous methods explicitly require you to define the method's parameter types and return type. An expression lambda with an expression as its body: (input−parameters) => expression A statement lambda with a statement block as its body: (input−parameters) => {} Any lambda expression can be converted to a delegate type. The delegate type that a lambda expression can be converted to is defined by the types of its parameters and return value. If the lambda expression does not return a value, you can convert it to Ac
- C#.Net Tutorial 658 2023-09-08 14:25:15
-
- CopyOnWriteArrayList version in C#
- Java has CopyOnWriteArrayList, but C# does not. For this purpose, the SynchronizedCollection class in C# should be used in preference. SynchronizedCollection is a thread-safe collection containing objects of a specific type. The following is the syntax. publicclassSynchronizedCollection<T>:IList<T>,ICollection<T>,IEnumerable<T>,IEnumerable,IList,ICollection above, T is
- C#.Net Tutorial 1360 2023-09-08 13:25:02
-
- What are the binary literal and number separators in C# 7.0?
- Binary literals - Before C#7, we could only assign decimal and hexadecimal values to a variables. Binary literals were introduced in C# 7.0, which allow us to pass binary values to variables. Number separator - The number separator takes the form of a single underscore (_). This separator can be used in any numerical text as a way to improve legibility. Binary literal example - example classProgram{ publicstaticvoidMain(){ varbn=0b1000001; &am
- C#.Net Tutorial 1176 2023-09-08 12:53:02
-
- Mixed dictionary classes in C#?
- The HybridDictionary class implements IDictionary by using ListDictionary when the collection is small, then switching to Hashtable when the collection gets larger. The following are the attributes of the HybridDictionary class: Serial Number Attribute and Description 1Count Gets the number of key/value pairs contained in the hybrid dictionary. 2IsFixedSize Gets a value indicating whether the HybridDictionary has a fixed size. 3IsReadOnly Gets a value indicating whether the HybridDictionary is read-only. 4IsSynchronized gets a value indicating HybridDic
- C#.Net Tutorial 745 2023-09-08 11:57:09
-
- C# program to illustrate upper triangular matrix
- For an upper triangular matrix, set all elements below the main diagonal to zero. Set the following conditions −if(i<=j) Console.Write(A[i,j]+"\t"); else Console.Write("0\t"); The above conditions will remove the Matrix elements are set to 0. Example You can try running the following code to display an upper triangular matrix. Live demonstration usingSystem;usingSystem.Linq;classDemo{
- C#.Net Tutorial 1471 2023-09-08 10:13:14
-
- C# Numeric promotion of conditional expressions
- Numeric promotion is the promotion of a smaller type to a larger type, such as short to int. In the example below, we see numeric promotion in a conditional expression. p>Short types are automatically promoted to larger int types. Example usingSystem;classProgram{ staticvoidMain(){ shortval1=99; intval2; &
- C#.Net Tutorial 752 2023-09-08 09:25:08
-
- How are parameters passed in C#?
- Parameters are passed by value or reference in C#. This way you can also pass parameters using out parameters and param array -Value This method copies the actual value of the parameter into the formal parameter of the function. In this case, changes made to the formal parameters inside the function have no effect on the actual parameters. Reference This method copies a reference to the memory location of the actual parameter into the formal parameter. This means that changes made to the parameters affect the parameters. Outreturn statement can be used to return only a value from a function. However, using output parameters you can return two values from the function. Output parameters are similar to reference parameters, except they pass data out of a method instead of into it. Param you are not sure about the number of parameters passed as parameter when declaring method
- C#.Net Tutorial 812 2023-09-07 23:09:07
-
- What are the advantages of using C# ASP.NET WebAPI?
- WEBAPI is a better choice for simpler, lightweight services. WEBAPI can use any text format including XML and is faster than WCF. It works the same way as HTTP, using standard HTTP verbs such as GET, POST, PUT, and DELETE for all add, delete, modify, and query operations. Full support for routing using MediaTypeFormatter to generate responses in Json and XML formats. It has the ability to be hosted in IIS or self-hosted outside of IIS. Supports model binding and validation. Support ODATA. Supports stateless data transfer. Supports Url mode and HTTP methods. Note - ODATA (Open Data Protocol) is an open protocol that allows
- C#.Net Tutorial 753 2023-09-07 21:41:02
-
- What is the role of the IWebHostEnvironment interface in C# ASP.NET Core?
- IWebHostEnvironment provides information about the web hosting environment and the application that is running. The interface belonging to the namespace Microsoft.AspNetCore.HostingIWebHostEnvironment needs to be injected into the controller as a dependency and then used throughout the controller. The IWebHostEnvironment interface has two properties. WebRootPath - The path to the www folder (gets or sets the absolute path to the directory containing the application content files for the web service) ContentRootPath - The path to the root folder containing all application files (gets or sets the path to the WebRootP
- C#.Net Tutorial 1298 2023-09-07 20:33:14
-
- How to implement dependency injection using interface-based injection in C#?
- The process of injecting (converting) coupled (dependent) objects into decoupled (independent) objects is called dependency injection. Types of dependency injection There are four types of DI − Constructor injection Setter injection Interface based injection Service locator injection Interface injection Interface injection Similar to Getter and SetterDI, Getter and SetterDI use default getters and setters, but interface injection uses the supporting interface ( An explicit getter and setter for setting interface properties). Example publicinterfaceIService{ stringServiceMethod();}publ
- C#.Net Tutorial 1286 2023-09-07 20:09:07
-
- How to download file from URL in C#?
- Files can be downloaded from a URL using a web client. It can use namespaces in System.Net. The WebClient class provides common methods for sending or receiving data to any local, intranet, or Internet resource identified by a URI. A web client can be called an application or a web browser (e.g. Google Chrome, Internet Explorer, Opera, Firefox, Safari) that is installed on the computer and used to interact with the web server based on the user's request. It is basically a consumer application which collects processed data from the server. The client and server are two parts of the connection, they are two different
- C#.Net Tutorial 1420 2023-09-07 19:33:06
-
- C# program to find integers from a list of objects and sort them using LINQ
- Introduction In this article, we will learn how to write a C# program to find integers from a list of objects and sort them using LINQ. Let's give a brief overview of the language. The C# programming language is frequently used to develop desktop, web, and mobile applications. Language-Integrated Query (sometimes called LINQ) is one of C#'s strengths. Developers can quickly query data from a variety of sources, including arrays, collections, and databases. It enables developers to use syntax equivalent to SQL (Structured Query Language) and supports simple data manipulation and sorting. It provides a standard syntax for data querying regardless of the data source. Since LINQ's syntax is similar to SQL, developers can easily learn and use it. The problem is stated in this article,
- C#.Net Tutorial 811 2023-09-07 18:57:12
-
- Networking in C#
- .NET Framework has a layered, extensible and managed network services implementation. You can easily integrate them into your application. Use System.Net; namespace. Let's see how to access the Uri class: In C#, it provides an object representation of a Uniform Resource Identifier (URI) - Uriuri=newUri("http://www.example.com/");WebRequestw=WebRequest.Create( uri); Now let us look at the System.Net classes. This is used to encrypt the connection using Secure Sockets Layer (SSL). If the URI ends with "https:
- C#.Net Tutorial 927 2023-09-07 18:29:09
-
- Implementing a stack in C#
- The Stack class is implemented in C# using Push and Pop operations. Stack is used in C# to represent a last-in-first-out collection of objects. The following are the methods of the Stack class - Sr.No. method and description 1 publicvirtualvoidClear(); removes all elements from the stack. 2publicvirtualboolContains(objectobj); Determine whether the element is on the stack. 3publicvirtualobjectPeek(); returns the object at the top of the Stack without deleting it. 4 Public virtual object Pop(); removes and returns the object at the top of the stack. 5publicvirtualvoidPus
- C#.Net Tutorial 829 2023-09-07 16:17:10
-
- What is the difference between implicit type conversion and explicit type conversion in C#?
- Following are the differences between implicit type conversions and explicit type conversions − Implicit type conversions C# performs these conversions in a type-safe manner. To understand this concept, let us implicitly convert int to long. intval1=11000;intval2=35600;longsum;sum=val1+val2; Above, we have two integer variables and when we accumulate them into a long integer variable, no error will be displayed. Because the compiler will perform implicit conversions by itself. Now let's print these values. Example usingSystem;usingSystem.IO;namespaceDemo{ &
- C#.Net Tutorial 890 2023-09-07 15:41:09