Possible Duplicate:
What is the “??” operator for?
I have recently come across the ?? operator in C#. What does this operator do and when would someone use it?
Example:
string name = nameVariable ?? string.Empty;
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.
The ?? operator basically means “or if it is null, blah“. It is equivalent to:
Which, if you’re not familiar with the syntax, is basically: