The type in the variable definition is followed by a question mark, meaning that the data type is of type nullable. When setting an initial value for a variable, assign a value of NULL to the variable (int type), not to 0!
Example:
Int? i = 3 equals to nullable<int> i = new nullable<int> (3);
An int? is another way to nullable<int> a generic type.
Null values are allowed when defining a method:
Public voidAddUser (stringNamestringPasswordint?role) { //content slightly ...} //UseAddUser ("Xiao Ming","123456",NULL);//default NULL for non-audited usersAddUser ("Xiao Wang","123456",1);//AdministratorAddUser ("How to ask","123456",2);//Normal UserView Plaincopy to Clipboardprint? Public voidAddUser (stringNamestringPasswordint?role) { //content slightly ...} //UseAddUser ("Xiao Ming","123456",NULL);//default NULL for non-audited usersAddUser ("Xiao Wang","123456",1);//AdministratorAddUser ("How to ask","123456",2);//Normal User
2. Variable definition in the type after the two question mark, used to determine and assign a value, the first to determine whether the current variable is null, if it is possible to assign a new value, otherwise skip! Means to take the assigned value?? To the left, if NULL on the left, take the assigned value?? On the right.
Example: Page?? 0, which indicates that the page is null, take the right value of 0.
Recommendation: http://www.cnblogs.com/roucheng/p/3562327.html
Resolve type and add question mark and double question mark