Is there anyway to have the var be of a nullable type?
This implicitly types i as an int, but what if I want a nullable int?
var i = 0;
Why not support this:
var? i = 0;
var
is typed implicitly by the expression or constant on the right hand side of the assignment. var
in and of itself is not a type so Nullable<var>
is not possible.
Why support it? If that's what you mean, you should say var i = (int?)0;
instead.
(Well, you should probably just say int? i = 0
, but for more complicated types, etc.)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With