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

  • What are Lambda expressions in C#?
    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 670 2023-09-08 14:25:15
  • CopyOnWriteArrayList version in C#
    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 1370 2023-09-08 13:25:02
  • What are the binary literal and number separators in C# 7.0?
    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 1189 2023-09-08 12:53:02
  • Mixed dictionary classes in C#?
    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 757 2023-09-08 11:57:09
  • C# program to illustrate upper triangular matrix
    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 1480 2023-09-08 10:13:14
  • C# Numeric promotion of conditional expressions
    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; &amp
    C#.Net Tutorial 760 2023-09-08 09:25:08
  • How are parameters passed in C#?
    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 820 2023-09-07 23:09:07
  • What are the advantages of using C# ASP.NET WebAPI?
    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 766 2023-09-07 21:41:02
  • What is the role of the IWebHostEnvironment interface in C# ASP.NET Core?
    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 1315 2023-09-07 20:33:14
  • How to implement dependency injection using interface-based injection in C#?
    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 1300 2023-09-07 20:09:07
  • How to download file from URL in C#?
    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 1448 2023-09-07 19:33:06
  • C# program to find integers from a list of objects and sort them using LINQ
    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 828 2023-09-07 18:57:12
  • Networking in C#
    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 942 2023-09-07 18:29:09
  • Implementing a stack in C#
    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 845 2023-09-07 16:17:10
  • What is the difference between implicit type conversion and explicit type conversion in C#?
    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 907 2023-09-07 15:41:09

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