Software Development

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.