I was looking at the dapper page and saw this terse bit of coding:
new { Age = (int?)null, Id = guid });
What does (int?)null do?
Could someone please elucidate what is going on there, and perhaps give a more “verbose” version of the code?
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.
int?is shorthand forNullable<int>. as such this line of code is converting null (which by default is of typeobject) to a null int.Docs: http://msdn.microsoft.com/en-us/library/b3h38hb0.aspx