In this post on LINQ To SQL Examples, I will explain how to create an application that manipulates and retrieves data from a database using LINQ to SQL. To begin with, let us first understand what is LINQ to SQL. Basically, it is a mechanism for database access and manipulation using database objects rather than using a …
A Beginner’s Tutorial on WPF in C#
In this post on A Beginner’s Tutorial on WPF in C#, I will show how to create a simple Windows Presentation Foundation (WPF) application. As you already know, using C# we can create several types of applications. Therefore, we can develop a console application in C# as well as a GUI application. In this article, …
Explaining C# Records with Examples
In this post on Explaining C# Records with Examples, I will explain a new feature of C# 9.0 called Records. Basically, Record is a new feature of C#, so you need to install the latest version of Visual Studio in order to use it. After installing Visual Studio, create a console application in C# and open …
Everything about Tuples in C# and When to Use?
In this post on Everything about Tuples in C# and When to Use? I will explain the tuples in C# in detail with the help of several examples. The most important point about tuples is that they allow you to group multiple unrelated data values in the same data structure and therefore the tuples provide …
Creating Jagged Arrays in C#
Jagged arrays in C# are two-dimensional arrays with the number of columns not necessarily the same for each row. As opposed to the two-dimensional rectangular arrays, we can define the different sizes of each row in a jagged array. In this post on Creating Jagged Arrays in C#, I will explain jagged arrays and their …
Linear Search and Binary search in C#
In this post, you will learn Linear Search and Binary Search in C#. Searching algorithms have applications in many computer science applications. Basically, searching algorithms allow the user to find a target element given the list of elements. In fact, we can use two common searching techniques – The Linear Search and Binary Search to …
Learning Indexers in C#
C# language has an important feature called Indexer which allows us to represent objects as arrays. In this post on Learning Indexers in C#, I will discuss Indexers and also demonstrate their usage with the help of a few examples. Basically, an indexer is a syntactical convenience that enables us to work with arrays that …
Object Initializers in C#
Object Initializers in C# provide us a way to initialize objects without using constructors. Examples of Object Initializers in C# You can use the object initializer syntax to initialize an object as well as to initialize a collection also. In this section, you will find several examples of the usage of object initializers. Example 1: …
Examples of Static Constructors in C#
In this post, I will explain a few Examples of Static Constructors in C#. The static constructors in a class serve the purpose of initializing the static fields in that class. Therefore, if you have the static fields defined in a class, then use the static constructor to initialize them. Since static fields are applicable …
When should We Use Private Constructors?
In this post, I will answer the question When should We Use Private Constructors? For the basic information on private constructors, you can read this post on Private and Static Constructors in C#. As you already know the basic purpose of defining a constructor in a class is to create the instance of that class. Further, …