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

  • How can we inject service dependency into controller C# Asp.net Core?
    How can we inject service dependency into controller C# Asp.net Core?
    ASP.NET Core injects objects of dependent classes through constructors or methods by using the built-in IoC container. The built-in container is implemented by IServiceProvider and supports constructor injection by default. Containers of types (classes) managed by built-in IoC are called services. In order for the IoC container to automatically inject our application services, we first need to register them with the IoC container. Example publicinterfaceILog{ voidinfo(stringstr);}classMyConsoleLogger:ILog{ publi
    C#.Net Tutorial 1237 2023-09-10 12:49:02
  • How do arrays work in C#?
    How do arrays work in C#?
    An array represents a fixed number of elements of a given type. Elements are stored in contiguous blocks of memory, and you can access elements efficiently as long as you know their index. The C# syntax for declaring and initializing an array is as follows - //createastringarraytohold5languagesstring[]languages=newstring[3]; After declaring an array, you can use the square symbol on the array to fill the items in the array. languages[0]="csharp";languages[1]="visualbasic";languages[2]=&quo
    C#.Net Tutorial 1322 2023-09-10 09:41:08
  • What are bin and obj folders in C#?
    What are bin and obj folders in C#?
    Whenever we write C# code and build or run the solution it generates 2 folders - binobj these bins and obj have compiled code why are there 2 folders? The reason is that the compilation process goes through 2 steps: compilation and linking. During the compilation process, each individual file is compiled into a separate unit. These compiled files will later be linked into a unit, which can be a dll or an exe. The compilation phase occurs anything will be added to the obj folder the final compilation of the link stage will go into the bin folder this obj folder is used for conditional compilation or incremental compilation Ex - I have a big project which has multiple solutions and multiple files Suppose if I change any one file and build the solution then only that file
    C#.Net Tutorial 987 2023-09-10 08:01:03
  • Keywords in C#
    Keywords in C#
    Keywords are reserved words predefined by the C# compiler. These keywords cannot be used as identifiers. However, if you want to use these keywords as identifiers, you can precede the keywords with the @ character. Following are the two types of keywords in C#. reserved keyword abstract as base Booltd > break bytes case capture character selected class const continue decimal default delegate execute double other enum event td > explicit external false finally fix float forforeach go to if implicit inin (universal modifier) ​​int Inside the interface is the Locklong namespace newnull object operator Outout (universal modifier) ​​override parameter private protected public read-only ref return
    C#.Net Tutorial 836 2023-09-09 22:41:09
  • How to display up to 2 decimal places or simple integer using string format in C#?
    How to display up to 2 decimal places or simple integer using string format in C#?
    Converts the object's values ​​to a string according to the specified format and inserts them into another string. Each overload of the Namespace:SystemAssembly:System.Runtime.dllFormat method uses the compound formatting functionality to include zero-based indexed placeholders (called format items) in the compound format string. At run time, each format item is replaced by the string representation of the corresponding parameter in the parameter list. If the parameter value is null, the format item is replaced with String.Empty. Example classProgram{ staticvoidMain(str
    C#.Net Tutorial 1164 2023-09-09 22:01:06
  • How to remove items from hash table collection in C#?
    How to remove items from hash table collection in C#?
    Hashtable in C# is a collection of key-value pairs organized based on key hash codes. Items in a hashtable can be accessed using keys. C#'s Hashtable class is a class that implements hashtable. Using this class we can create a new hash table object with the help of the provided constructor. The Hashtable class also provides various methods with which we can perform various operations on the hash table. These operations include adding an item, checking if a specified key exists, counting the number of items, deleting items from a hash table, etc. In this article, we will discuss removing an item from a hash table collection given a specified key. How to delete items from Hashtable collection? Hashtable class
    C#.Net Tutorial 683 2023-09-09 21:01:06
  • C# program displays the use of the GetEnvironmentVariable() method of the environment class
    C# program displays the use of the GetEnvironmentVariable() method of the environment class
    In C#, the GetEnvironmentVariable() method of the Environment class is used to obtain the value of the environment variable. It is a useful method for retrieving system-wide and user-specific environment variables. In this article, we will discuss the usage of GetEnvironmentVariable() method and understand how to use it in C# program. What is the GetEnvironmentVariable() method? The GetEnvironmentVariable() method is a static method of the Environment class in C#. It takes the name of the environment variable as a string and returns the variable's value as a string. if
    C#.Net Tutorial 1441 2023-09-09 20:13:02
  • C# program to find all substrings in a string
    C# program to find all substrings in a string
    Find all substrings in a string using the substring() method in C#. Assuming our string is - start,i); Console.WriteLine(substr);} Example The following is C to find all substrings in a string
    C#.Net Tutorial 832 2023-09-09 18:57:02
  • Check if path has file extension in C#
    Check if path has file extension in C#
    In the vast world of programming, C# has become a powerful, flexible, and object-oriented language that is widely used to create Windows applications, web services, and games. One of the common tasks that developers often find themselves needing to perform is checking whether a path has a file extension. In this article, we will dive into the details of how to accomplish this task in C#. Introduction to Path Handling in C# Before moving on to the topic, let’s take a brief look at path handling in C#. .NET Framework provides a Path class that comes with various static methods to perform operations on string instances containing file or directory path information. These methods save time and help prevent errors. Check file extension necessary
    C#.Net Tutorial 1515 2023-09-09 17:17:06
  • What is the role of the IStructuralEquatable interface in C#?
    What is the role of the IStructuralEquatable interface in C#?
    The IStructuralEquatable interface defines methods that support comparing objects for structural equality, which means that two objects are equal because they have equal values. It includes the following two methods - Sr.No Method & Description 1Equals(Object, IEqualityComparer) This method determines whether the object is structurally equal to the current instance. 2GetHashCode(IEqualityComparer) method of the hash code of the current instance. Let's see an example where I create Tuple object and use IstructuralEquatable interface: Create Tuple-vartupleOne
    C#.Net Tutorial 617 2023-09-09 17:01:08
  • What is the purpose of StringBuilder class in C#?
    What is the purpose of StringBuilder class in C#?
    In C#, strings are immutable. This means that the string cannot be modified once created. Any modification to the string returns a new string containing the modifications, while the original string remains unchanged. stringword="aaabbbccc";stringnewWord=word.Replace('b','d');Console.WriteLine(word);//printsaaabbbcccConsole.WriteLine(newWord);//printsaaaddd
    C#.Net Tutorial 942 2023-09-09 16:53:02
  • What is the role of the ICollection interface in C#
    What is the role of the ICollection interface in C#
    In C#, the ICollection interface defines the sizes, enumerators, and synchronization methods for all non-generic collections. It is the basic interface for classes in the System.Collections namespace. The following are the attributes of the ICollection interface: Serial number attribute name and description 1Count the number of elements in the ICollection 2SyncRoot gets an object for synchronous access to the ICollection. The following are the methods of the ICollection interface: Serial number method name and description 1CopyTo(Array^,Int32) This method copies the elements of the ICollection into an array. 2GetEnumerator
    C#.Net Tutorial 820 2023-09-09 16:33:04
  • Queue interface in C#
    Queue interface in C#
    A queue represents a first-in, first-out collection of objects. Use this when you need first-in-first-out access to items. When you add an item to the list, it's called enqueuing, and when you remove an item, it's called deque. Let's see an example of Queue class. To add elements, use Enqueue-Queueq=newQueue();q.Enqueue('X');q.Enqueue('Y');q.Enqueue('Z'); To remove elements, use Dequeue-/ /removeelementswhile(
    C#.Net Tutorial 699 2023-09-09 15:45:08
  • How to run external application through C# application?
    How to run external application through C# application?
    You can use Process to run external applications from a C# application. A process is a program that runs on your computer. This can be anything from a small background task (such as a spell checker or a system event handler) to a full-blown application (such as Notepad, etc.). Each process provides the resources needed to execute the program. Every process is started by a thread, called the main thread. A process can have multiple threads in addition to the main thread. Processes heavily depend on the available system resources, while threads require minimal resources, so processes are considered heavyweight processes, while threads are called lightweight processes. The process exists in the System.Diagnostics namespace. Example usin of running notepad from C# application
    C#.Net Tutorial 1471 2023-09-09 15:05:01
  • What is the base class for all exceptions in C#?
    What is the base class for all exceptions in C#?
    The System.SystemException class is the base class for all predefined system exceptions. Some exception classes derived from System.Exception class are System.ApplicationException and System.SystemException classes. The System.ApplicationException class supports application-generated exceptions. Therefore, programmer-defined exceptions should be derived from this class. The following are the exceptions under the base class System.SystemException: Sr.No. Exception class and description 1System.IO.IOException handles I/O errors.
    C#.Net Tutorial 740 2023-09-09 13:29:14

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