How to assign null value to value type variable in C#

If you have a value type variable in your program and you want to assign a null value to it you cannot do this without making that variable nullable as following code shows:

int? i = null;



About author

User avatar

Waqas Anwar

Founder of, Senior Consultant, Microsoft .NET and Web Technologies