C# Multi-dimension Array

// Two-dimensional array. int[,] array2D = new int[,] { { 1, 2 }, { 3, 4 }, { 5, 6 }, { 7, 8 } }; // A similar array with string elements. string[,] array2Db = new string[3, 2] { { "one", "two" }, { "three", "four" }, { "five", "six" } }; // Three-dimensional... » read more

Immutable Type

An immutable type, in the context of C#, is a type of object whose data cannot be changed after its creation. An immutable type sets the property or state of the object as read only because it cannot be modified after it is assigned during initialization. Immutable types are designed for efficient memory management and better speed,... » read more

Dictionary And Hashtable In C#

Dictionary and Hashtable in C# are used to hold data as a collection of key-value pair. Dictionary Dictionary is generic type Dictionary<TKey,TValue> Dictionary class is a strong type < TKey,TValue > Hence, you must specify the data types for key and value. There is no need of boxing/unboxing. When you try to access non existing... » read more

Boxing and Unboxing in c#

Boxing is the process of converting a value type to the type object or to any interface type implemented by this value type. When the CLR boxes a value type, it wraps the value inside a System.Object and stores it on the managed heap. Unboxing extracts the value type from the object. Boxing is implicit; unboxing is explicit.... » read more

C# Error Handling

The Anatomy of C# Exceptions Exceptions allow an application to transfer control from one part of the code to another. When an exception is thrown, the current flow of the code is interrupted and handed back to a parent try catch block. C# exception handling is done with the follow keywords: try, catch, finally, and... » read more

Dispose() vs Final()

The finalizer method is called when your object is garbage collected and you have no guarantee when this will happen (you can force it, but it will hurt performance). The Dispose method on the other hand is meant to be called by the code that created your class so that you can clean up and release any... » read more

Asynchronous programming with async and await (C#)

The async and await keywords in C# are the heart of async programming. By using those two keywords, you can use resources in the .NET Framework, .NET Core, or the Windows Runtime to create an asynchronous method almost as easily as you create a synchronous method. Asynchronous methods that you define by using the async keyword are referred to as async... » read more

Language Integrated Query (LINQ)

Language-Integrated Query (LINQ) is the name for a set of technologies based on the integration of query capabilities directly into the C# language. Traditionally, queries against data are expressed as simple strings without type checking at compile time or IntelliSense support. Furthermore, you have to learn a different query language for each type of data... » read more

C# Serialization

Serialization is the process of converting an object into a stream of bytes to store the object or transmit it to memory, a database, or a file. Its main purpose is to save the state of an object in order to be able to recreate it when needed. The reverse process is called deserialization. Uses... » read more