In this post, I will discuss several New Features of C# 9. In fact, the latest release of C# has added many new features for making coding easier. Here, I will explain Records, Init-Only properties, Top-Level statements, module initializers, and use of new(). Following are the New Features in C# 9 The important New Features …
IEnumerable and IEnumerator Interfaces
IEnumerable and IEnumerator Interfaces in C# have been implemented by a number of collection classes. Basically, these interfaces provide the functionality for traversing the elements of a collection. Basically, IEnumerator is something that can enumerate or visit the elements of a collection. Therefore, if any class implements IEnumerator, it has the ability to enumerate a collection. On …
KeyValuePair and its Applications
Today I will discuss KeyValuePair and its Applications. Basically, it is a collection in C# that combines two objects together – one is called a key, and another one is called a value. Essentially, it is a generic struct. The namespace System.Collections.Generic contains the KeyValuePair struct. Creating a KeyPaluePair We use the constructor KeyValuePair<TKey, TValue)(k, v) to create its instance as shown below. …
C# Root Class – Object
In this post, I will explain C# Root Class – Object which every class inherits from. Specifically, each type in C# has a base class, whether it is a reference type or a value type. Particularly, this base class is called Object. Also, the Object class provides several methods that any class can either use or override. …
Access Modifiers in C#
In this post on Access Modifiers in C#, I will explain various types of access modifiers in C# that we can use with a class and members of the class. Basically, an access modifier is a keyword that determines where a class member is visible in the application. In brief, the access modifiers determine the …
Learning Properties in C#
In this post on Learning Properties in C#, I will talk about an important member of a C# class called the Property. Usually, we have private fields in a class that we can manipulate using methods. However, many times we don’t need to do anything else with those private fields except setting and getting their …
Learning All Class Members in C#
In this post on Learning All Class Members in C#, I will talk about the different kinds of members that a class in C# can have. Like other object-oriented programming languages, a C# class can have data members and methods that operate on those data members. However, a C# class can have several other types …
Examples of Extension Methods in C#
In this post on Examples of Extension Methods in C#, I will explain the concept of extension methods in C# using several examples. Before getting started with examples let us first understand the extension methods. In fact, extension methods make it possible to add in the existing functionality. In other words, suppose we already have a library …
How to Setup a Connection with SQL Server Database in Visual Studio
In this post on How to Setup a Connection with SQL Server Database in Visual Studio, I will demonstrate a step by step procedure for creating an SQL Server Database and set up a connection. Also, I will describe how to retrieve data using a C# application. Let us start with a console application in …
Understanding the Concept of Nested Classes in C#
In this post on Understanding the Concept of Nested Classes in C#, I will explain the Nested Types using several examples. Basically, a nested type encloses the definition of another type. Important Points to Remember about Nested Types The nested class is not accessible outside the containing class since it is a member of the containing class. …