Category: C#

Using Null Coalescing Operator in C#

Sometimes , you may want to simply the Null checks in your .NET Program without much usage of the if statements . The Null Coalescing Operator can be used in this scenario. Using Null Coalescing Operator in C#

C# Compiler Error – CS1959 ‘{0}’ is of type ‘{1}’. the type specifi

In this blog post, you’ll learn more about the C# Compiler Error – CS1959 and the related message description C# Compiler Error Code CS1959 C# Compiler Description for the Code :CS1959 ‘{0}’ is of type ‘{1}’. The type specified in a constant declaration must be sbyte, byte, short, ushort, int, uint, long, ulong, char, float, double, decimal, bool, string, an enum-type, or a reference-type.

Implicit Type Inference in C#

There are times when you want to declare a variable and assign a value to it even without having to figure out what the data type of the variable is . In C# , the var keyword provides the type inference feature where the compiler decides what type the local variable is . Below is a sample code snippet demonstrating the Implicit Type Inference in…