Open Source Your Knowledge, Become a Contributor
Technology knowledge has to be shared and made accessible for free. Join the movement.
int? a = null;
Console.WriteLine(a ?? 5);
// Equivalent ternary : a != null ? a : 5
Enter to Rename, Shift+Enter to Preview
The ?? operator allows you to assign the variable if it is not null otherwise it assigns the right value.
Open Source Your Knowledge: become a Contributor and help others learn. Create New Content