What does ? mean:
public bool? Verbose { get; set; }
When applied to string?, there is an error:
The type ‘string’ must be a non-nullable value type in order to use it as parameter ‘T’ in the generic type or method ‘System.Nullable’
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.
?makes your non-nullable (value) types nullable. It doesn’t work forstring, as it is reference type and therefore nullable by default.From MSDN, about value types:
?is basically a shorthand forNullable<T> structure.If you want to know more, MSDN has a great article regarding this topic.