C#问号运算符后缀为强制转换

Tim*_*Tim 2 c# operators

我正在看着这个精致的页面,看到了这个简洁的编码:

   new { Age = (int?)null, Id = guid });
Run Code Online (Sandbox Code Playgroud)

怎么(int?)null办?

有人可以说明那里发生了什么,也许可以给出一个更"冗长"的代码版本?

Jam*_*iec 6

int?是简写Nullable<int>.因此,这行代码将null(默认为类型object)转换为null int.

文档:http://msdn.microsoft.com/en-us/library/b3h38hb0.aspx