How to convert C# nullable int to int

The other answers so far are all correct; I just wanted to add one more that’s slightly cleaner: v2 = v1 ?? default(int); Any Nullable<T> is implicitly convertible to its T, PROVIDED that the entire expression being evaluated can never result in a null assignment to a ValueType. So, the null-coalescing operator ?? is just … Read more