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

  • Hash tables and dictionaries in C#
    Hash tables and dictionaries in C#
    Hash Tables Hash tables are used when a key is needed to access an element, and useful key values ​​can be identified. Each item in the hash table has a key/value pair. Keys are used to access items in the collection. Members in hash tables are thread-safe. If we try to find a key that doesn't exist, it will return null. Hashtable is not a generic type. Hashtable collections are slower than dictionaries because it requires boxing and unboxing. Declare Hashtable-Hashtableht=newHashtable(); Dictionary A dictionary is a collection of keys and values ​​in C#. Dictionary is contained in the System.Collection.Generics namespace. Dicti
    C#.Net Tutorial 762 2023-09-10 23:29:08
  • Check if given range is equal in C#
    Check if given range is equal in C#
    As programmers, we often encounter situations where we need to compare two ranges in programming languages ​​like C#. Whether we are working on a complex algorithm or a simple program, checking whether two ranges are equal is a critical task. This article will discuss the process and methods of comparing two given ranges in C#, providing a simple solution to this common problem. Understanding Scope in C# Before we proceed to solve the problem, it is crucial to have a deep understanding of scope in C# programming language. Ranges are a new feature introduced in C# 8.0 that provide syntax for working with subsets of different types of data, such as arrays, strings, and spans. You can use two dots ("..") to define the range. For example, an expression like "1..4" represents the range containing 1, 2, and 3
    C#.Net Tutorial 851 2023-09-10 23:09:02
  • What are non-static classes in C#?
    What are non-static classes in C#?
    Non-static classes can be instantiated, but static classes cannot be instantiated, that is, you cannot use the new keyword to create variables of class type. Non-static classes can have instance methods and static methods. Members of a static class are accessed using the class name itself, and static classes are sealed. Non-static class example-publicclassCalculateStatic class example-publicstaticclassCalculate
    C#.Net Tutorial 1061 2023-09-10 22:49:11
  • Generics in C#
    Generics in C#
    Generics allow you to write classes or methods that can be used with any data type. Write a specification for a class or method and use substitution parameters for data types. When the compiler encounters a function call to a class's constructor or method, it generates code that handles the specific data type. Generics is a technology that enriches your programs by − It helps you maximize code reusability, type safety, and performance. You can create generic collection classes. The .NET Framework class library includes several new generic collection classes in the System.Collections.Generic namespace. You can use these generic collection classes instead of the collection classes in the System.Collections namespace. you can
    C#.Net Tutorial 1186 2023-09-10 21:57:11
  • Packages in C#
    Packages in C#
    As an alternative to packages in Java, the C# language has namespaces. Packages in Java Packages are used in Java to prevent naming conflicts, control access, and make it easier to search/locate and use classes, interfaces, enumerations, annotations, etc. Namespaces in C# Namespaces are designed to provide a way to keep one set of names separate from another. A class name declared in one namespace does not conflict with the same class name declared in another namespace. A namespace definition begins with the keyword namespace, followed by the namespace name. Below shows how to use namespaces in C# - example usingSystem;namespacefirst_space{ &nb
    C#.Net Tutorial 1109 2023-09-10 21:17:02
  • Sorting HashMap based on keys in C#
    Sorting HashMap based on keys in C#
    HashMap is a Java language, not a C# language. HashMap in C# is equivalent to Dictionary and is used as a collection of key-value pairs. First, set Dictionary-Dictionary<string,int>d=newDictionary<string,int>();d.Add("soccer",1);d.Add("cricket",2);d.Add("tennis ",3);d.Add("rugby",4);Now
    C#.Net Tutorial 1237 2023-09-10 20:45:10
  • How to use C# BinaryReader class?
    How to use C# BinaryReader class?
    If you want to read binary information from a stream, use the BinaryReader class. The BinaryReader class is located in the System.IO namespace. The following shows using the BinaryReader class to read from a file - staticvoidWriteMe(){ using(BinaryWriterw=newBinaryWriter(File.Open("C:\abc.txt",FileMode.Create))){ w.Wr
    C#.Net Tutorial 999 2023-09-10 18:53:02
  • Cohesion in C#
    Cohesion in C#
    Cohesion in C# shows the relationship between modules. It shows the functional strength of the module. The higher the cohesion, the better the program design. It is a dependency between elements inside a module such as methods and inner modules. High cohesion will allow you to reuse classes and methods. An example of high cohesion can be seen in the System.Math class, i.e. it has mathematical constants and static methods - Math.AbsMath.PIMath.Pow A class that does many things at the same time is difficult to understand and maintain. This is what we call low cohesion and should be avoided. If a class will provide email, printing, copying, etc. functionality, it will be difficult to maintain and reuse. Always try to achieve strong i.e. high cohesion in your code.
    C#.Net Tutorial 1171 2023-09-10 18:25:02
  • What is the scope of protected member variables of a class in C#?
    What is the scope of protected member variables of a class in C#?
    Protected access specifiers allow subclasses to access member variables and member functions of their base class. This helps with inheritance. We will discuss this in more detail in the inheritance chapter. Below is an example that shows we set a protected member variable in class A. classA{ protectedinta2=87;} Now under the derived class, when we try to access the above variable from the derived class object, it will work fine as shown below - Example usingSystem;classA{ protectedinta2=87;}classB:A{&am
    C#.Net Tutorial 952 2023-09-10 18:17:08
  • What does LINQ return when the result is null in C#?
    What does LINQ return when the result is null in C#?
    Language Integrated Query (LINQ) is a set of queries based on integrating query functionality directly into the C# language. You can use C# to create SQL Server databases, XML documents, ADO.NET data sets, and any collection of objects that support the IEnumerable or genericIEnumerable<T> interfaces. In Linq-to-SQL, if you try to get the first element in a query with no results, the sequence you will get does not contain any elements Error ToList returns an empty list Example classProgram{ publicstaticvoidMain(){&
    C#.Net Tutorial 1099 2023-09-10 16:57:10
  • Double array in C#?
    Double array in C#?
    Arrays of arrays in C# are called jagged arrays. To declare a jagged array, use double[][]. Now let us declare them -int[][]marks; Now, let us initialize it where marks is an array of 5 integers -int[][]marks=newint[][]{newint[]{90,95} ,newint[]{89,94},newint[]{78,87},newint[]{76,68},newint[]{98,91}};Example Let us now take a look at the sawtooth array in C# Full example and learn how to implement it − live demonstration usingSystem
    C#.Net Tutorial 1087 2023-09-10 16:53:02
  • C# program to create a simple thread
    C# program to create a simple thread
    In order to create a thread, I created a function - publicvoidmyThread(){ for(inti=0;i<3;i++){ Console.WriteLine("MyThread"); }} Call the above function to create a thread and create a New ThreadStart delegate-Demod=newDemo();Threadthread=newThread(new
    C#.Net Tutorial 1201 2023-09-10 16:49:12
  • How to swap two numbers in C# without using temporary variables
    How to swap two numbers in C# without using temporary variables
    To swap two numbers, you can use a third variable and perform arithmetic operators without using temporary variables. Set two variables for exchange −val1=5;val2=10; Now perform the following exchange operation-val1=val1+val2;val2=val1-val2;val1=val1-val2; Example usingSystem;namespaceDemo{ classProgram{ staticvoidMain(string[ ]args){&a
    C#.Net Tutorial 1156 2023-09-10 16:37:02
  • The difference between ref and out in C#
    The difference between ref and out in C#
    In this article, we will understand the difference between "ref" and "out" in C#. The Ref keyword requires initialization of parameters before passing them to 'ref'. There is no need to initialize parameter values ​​before returning to the calling method. When using the 'ref' keyword, data can be passed in both directions. It is useful when the called method needs to change the value of the passed parameter. The output keyword does not require initialization of arguments before passing them to "out". The parameters need to be initialized before they are returned to the caller. When a method needs to return multiple values, it is helpful to declare parameters using the "out" keyword. When using the "out" keyword, data is passed in one direction only.
    C#.Net Tutorial 1091 2023-09-10 15:53:05
  • What are the different ways of overloading methods in C#?
    What are the different ways of overloading methods in C#?
    Different ways of overloading methods are-ThedatatypesofparametersaredifferentThenumberofparametersaredifferentAn example is given below to illustrate the different data types of parameters-voidprint(inti){ Console.WriteLine("Printingint:{0}",i);}voidprint(doublef){ Console .WriteLine(&quot
    C#.Net Tutorial 707 2023-09-10 15:13:05

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