private int? id这句话中的"?"的作用

 
 

int? 代表可以为null的int类型,一般情况下

int a,这个a只能赋值成int类型

int? a,除了可以赋值int类型的值外,还可以赋值为null,就是a = null;

参见

 

http://msdn.microsoft.com/zh-cn/library/2cf62fcy.aspx

使用可以为null 的类型(C# 编程指南)


http://msdn.microsoft.com/zh-cn/library/1t3y8s4s.aspx

可以为null 的类型(C# 编程指南)

posted @ 2012-08-04 11:04  siaslfs  阅读(871)  评论(0编辑  收藏  举报