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

  • How to add items to a hash table collection in C#
    How to add items to a hash table collection in C#
    We have discussed the basics of hash tables. Hash table collections in C# are used to store key-value pairs, where each key-value pair is organized based on the hash code of the key. The hash code is calculated using a hash code function. Internally, hash tables use buckets to store data. A bucket is nothing more than a set of virtual elements in a hash table. A hash code is associated with each bucket. From a programming perspective, a hash table is similar to a dictionary object, but unlike a dictionary object, a hash table can store objects of different data types. In terms of performance, hash tables exhibit lower performance because the data elements of hash tables are objects. Therefore, in order to store and retrieve values ​​from a hash table, boxing and unboxing of objects must be performed. In this article, we will discuss how to add items to a hash table collection.
    C#.Net Tutorial 1104 2023-09-12 09:49:02
  • What are Ref local variables and Ref return values ​​in C# 7.0?
    What are Ref local variables and Ref return values ​​in C# 7.0?
    Reference return values ​​allow methods to return a reference to a variable rather than a value. The caller can choose to treat the returned variable as being by value or by reference. The caller can create a new variable that is itself a reference to the return value, called reflocal. In the following example, even if we modify the color there is no effect on the original array color example classProgram{ publicstaticvoidMain(){ varcolors=new[]{"blue","green&qu
    C#.Net Tutorial 807 2023-09-11 22:37:02
  • What is implicit implementation of interfaces and when to use implicit implementation of interfaces in C#?
    What is implicit implementation of interfaces and when to use implicit implementation of interfaces in C#?
    C# interface members can be implemented explicitly or implicitly. Implicit implementation does not include the name of the interface being implemented before the member name, so the compiler infers this. These members will be exposed as public and accessible when the object is converted to a concrete type. Method invocation is no different. Just create an object of this class and call it. Implicit interface examples cannot be used if the same method name is declared in multiple interfaces interfaceICar{ voiddisplayCar();}interfaceIBike{ voiddisplayBike();}c
    C#.Net Tutorial 963 2023-09-11 22:17:06
  • C# program to find a list of students whose names begin with 'S' using the where() method of list collection using LINQ
    C# program to find a list of students whose names begin with 'S' using the where() method of list collection using LINQ
    Introduction The topic to be learned in this article is to write a C# program using the where() method of the List collection and LINQ to find the list of students whose names start with 'S'. Language Integrated Query aka LINQ is used to generate C# language queries. Previously we had to use other relational languages ​​such as SQL and XML. It provides more features to C# language or any other .NET language. The syntax for querying a database in LINQ is the same as querying data stored in an array. Before we proceed and understand the algorithm and code of the C# program, find the list of students whose names start with 'S' using the where() method of LINQ's ListCollection. Let’s briefly review the shorthand form of LINQ
    C#.Net Tutorial 1413 2023-09-11 21:29:02
  • C# equivalent to Java's Thread.setDaemon?
    C# equivalent to Java's Thread.setDaemon?
    C# is equivalent to Java's Thread.setDaemon, which is the concept of foreground and background threads. When the foreground thread closes, the background thread will also terminate. Foreground threads continue to run until the last foreground thread terminates. The property used for background threads is IsBackground, which gets or sets a value indicating whether the thread is a background thread. The default value for this property is false because the default thread created is the foreground thread. To create a thread daemon in C#, use isBackground-ThreadbgThread=newThread(tStart);bgThread.IsBackground=true;bgThrea
    C#.Net Tutorial 1194 2023-09-11 20:45:12
  • What does two question marks together (??) mean in C#?
    What does two question marks together (??) mean in C#?
    This is the null-coalescing operator. The null-coalescing operator returns the value of its left operand if the left operand is not null; otherwise, it evaluates the right operand and returns its result. The ?? operator does not evaluate its right operand if the left operand evaluates to non-null. A nullable type can represent a value that is undefined or comes from the type's domain. When the left operand has a nullable type, we can use the ?? operator to return the appropriate value. If we try to assign a nullable value type to a non-nullable value type without using the ?? operator, we will get a compile-time error and if we force a cast, an InvalidOperat will be thrown
    C#.Net Tutorial 884 2023-09-11 19:25:02
  • What is content negotiation in Asp.Net webAPI C#?
    What is content negotiation in Asp.Net webAPI C#?
    Content negotiation is the process of selecting the best representation for a given content response when multiple representations are available. Meaning, depending on the header values ​​in the accept request, the server sends a response. The primary mechanism for content negotiation in HTTP is that these request headers - Accept - responses can accept which media types, such as "application/json", "application/xml" or custom media types, such as "application/vnd.example+xml" ”Accept-Charset-What character sets are acceptable, such as UTF-8 or ISO8859-1.Accept-Encoding-What content encodings are acceptable, such as
    C#.Net Tutorial 616 2023-09-11 17:13:01
  • Thread-based parallelism in C#
    Thread-based parallelism in C#
    In C#, tasks are divided into parallel tasks. The task is then assigned to a separate thread for processing. In .NET, you can run code in parallel using the following mechanisms: threads, thread pools, and tasks. To achieve parallelism, use tasks instead of threads in C#. Tasks do not create their own operating system threads, but are executed by TaskScheduler. Let's see how to create a task. Use a delegate to start the task -Tasktsk=newTask(delegate{PrintMessage();});tsk.Start();Use the task factory to start the task-Task.Factory.StartNew(()=>{Console.
    C#.Net Tutorial 762 2023-09-11 16:09:02
  • What are the built-in message handlers in Asp.Net webAPI C#?
    What are the built-in message handlers in Asp.Net webAPI C#?
    A message handler is a class that receives an HTTP request and returns an HTTP reply. Message handlers are derived from the abstract HttpMessageHandler class. Message handlers provide us with the opportunity to process, edit or reject incoming messages before the request reaches the HttpControllerDispatcher. Message handlers execute earlier in the request processing pipeline, so they are a good place to implement cross-cutting concerns in WebAPI. A message handler is nothing more than a series of classes (it may be system-defined or by us) sitting next to the process that pipes HTTP requests and responses. For example, an HTTP request arrives at an HTTP server, and now the request will be passed to H
    C#.Net Tutorial 964 2023-09-11 15:45:06
  • What is type conversion in C#?
    What is type conversion in C#?
    Type conversion is the conversion of one data type to another type. The two forms are - Implicit type conversions - These conversions are performed by C# in a type-safe manner. For example, conversion from small to large integer types and conversion from derived classes to base classes. Explicit type conversions - These conversions are functions done explicitly by the user using predefined types. Explicit conversion requires a cast operator. Following are the built-in type conversion methods - Sr.No method and description 1ToBoolean converts the type to Boolean value (if possible). 2ToByte converts type to bytes. 3ToChar Converts a type to a single Unicode character if possible. 4ToDateTime when converting type (integer or string type) to date
    C#.Net Tutorial 1033 2023-09-11 13:49:22
  • Convert ValueTuple to Tuple in C#
    Convert ValueTuple to Tuple in C#
    Using C#, we can easily convert ValueTuple to Tuple using ToTuple() method. Note - Add System.ValueTuple package to run ValueTuple program. > Let's see how to add it - Go to your project in Solution Explorer right click on the project select "Manage NuGet Packages" You will reach the NuGet Package Manager. Now, click on “Browse” tab and find “ValueTuple” Finally, add System.ValueTuple package example usingSystem;classProgram{ stat
    C#.Net Tutorial 605 2023-09-11 12:13:02
  • How to create a folder in C# if it does not exist?
    How to create a folder in C# if it does not exist?
    In order to create the directory, we must first import the System.IO namespace in C#. A namespace is a library that allows you to access static methods for creating, copying, moving, and deleting directories. It is always recommended to check if a directory exists before performing any file operations in C# as the compiler will throw an exception if the folder does not exist. Example usingSystem;usingSystem.IO;namespaceDemoApplication{ classProgram{ staticvoidMain(str
    C#.Net Tutorial 1865 2023-09-11 11:57:09
  • String format for Double in C#
    String format for Double in C#
    Use the static method String.Format in C# to form a double string format. For three decimal places - String.Format("{0:0.000}",987.383); String.Format("{0:0.000}",987.38); String.Format("{0:0.000}",987.7899); For thousands separator - String.Format("{0:0,0.0}",54567.46);String.Format("{0
    C#.Net Tutorial 795 2023-09-11 11:29:02
  • How to convert integer to hexadecimal and vice versa in C#?
    How to convert integer to hexadecimal and vice versa in C#?
    Convert an integer to hexadecimal You can use the string.ToString() extension method to convert an integer to hexadecimal. IntegerValue:500HexadecimalValue:1F4ConvertingHexadecimaltoInteger−Ahexadecimalvaluecanbeconvertedtoanintegerusingint.Parseorconvert.ToInt32int.Parse−Convertsthestringrepresentationofa
    C#.Net Tutorial 943 2023-09-11 09:37:02
  • C# string methods
    C# string methods
    The String class has many methods to help you work with string objects. The following table lists some of the most commonly used methods - Sr.No method and description 1 public static int Compare (stringstrA, stringstrB) compares two specified string objects and returns an integer indicating their relative position in the sort order. 2publicstaticintCompare(stringstrA, stringstrB, boolignoreCase) compares two specified string objects and returns an integer indicating their relative position in the sort order. However, if the boolean parameter is true, case is ignored.
    C#.Net Tutorial 1126 2023-09-11 09:21:04

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