What is int? in C#?
Correct answer B. Shorthand for Nullable<int>, an int that can also hold null
T? for a value type T is shorthand for System.Nullable, a struct that holds a value plus a HasValue flag. So int? can be any int or null, which is useful for optional database columns. It is still a value type, not a heap wrapper. Reading .Value when HasValue is false throws InvalidOperationException, so use GetValueOrDefault or ?? instead.
Answer checked How we write and check questions
Discussion