C# – Lists

In C#, a list is a variable that is able to store multiple values of the same type and those values can be accessed by an index. This is similar to arrays which were covered in the previous post. However, unlike arrays, the size of the list does not need to be set at declaration …

C# – Lists Read More »

C# – Arrays

In programming, a variable is used to store a value in memory. Arrays are a type of variable that is able to store multiple values. Arrays can be thought of as a container of values. This article will explain how to use arrays in C#. In C#, arrays must be of the same data type …

C# – Arrays Read More »

C# – Null-Conditional Operators (?. and ?[])

The System.NullReferenceException: Object reference not set to an instance of an object. exception is a common exception in C#. This exception is thrown when a variable of reference type is null and it is attempted to be accessed. This error can be avoided by using if conditions to make sure the variable is not null …

C# – Null-Conditional Operators (?. and ?[]) Read More »

C# – Null-Coalescing Operator (??)

Using the null-coalescing operator is a concise way to check if a variable or function has a value before returning it and if the variable or function does not have a value then return a default value. In C#, two consecutive question mark characters ?? is used as the null-coalescing operator.

C# – String Interpolation

This tutorial will explain what string interpolation is and how to use it in the C# programming language. The tutorial will also compare strings created with string interpolation to strings created by concatenation and composite formatting to show the benefits of using string interpolation.