What is the basics of conversion of Not Nullable type to Nullable type?
What happens inside CLR ?
is value type is internally converted to reference type?
int i = 100;
and int ? i = 7?
is both are value type?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Run this to see that the
int?is a value type:I have found these to be very interesting and makes for some clever uses.
What
?does is create a nullable reference to an otherwise non-nullable value type. It is like having a pointer that can be checked –HasValue(a boolean value)? Nice thing about theNullable< T >is that theValueproperty does not need to be cast to it’s original type – that work is done for you inside the nullable struct.