What's the difference between 'int?' and 'int' in C#?
Solution 1:
int? is shorthand for Nullable<int>
.
This may be the post you were looking for.
Solution 2:
int? is Nullable.
MSDN: Using Nullable Types (C# Programming Guide)
Solution 3:
int? is the same thing as Nullable. It allows you to have "null" values in your int.
Solution 4:
int belongs to System.ValueType and cannot have null as a value. When dealing with databases or other types where the elements can have a null value, it might be useful to check if the element is null. That is when int? comes into play. int? is a nullable type which can have values ranging from -2147483648 to 2147483648 and null.
Reference: https://msdn.microsoft.com/en-us/library/1t3y8s4s.aspx