What does a question mark mean in C# code?
This question already has an answer here:
Question marks have different meaning in C# depending on the context.
The Null-Conditional Operator (MSDN, What does the question mark in member access mean in C#?)
Console.Write(myObject?.Items?[0].ToString());
The Conditional Operator/Ternary Operator (MSDN, Benefits of using the conditional ?: (ternary) operator)
return isTrue ? "Valid" : "Lie";
The Null Coalescing Operator (MSDN, What do two question marks together mean in C#?)
return myObject ?? yourObject;
Nullable Types (MSDN, What is the purpose of a question mark after a type (for example: int? myVariable)?)
int? universalAnswer = 42;
链接地址: http://www.djcxy.com/p/9122.html
上一篇: C#中问号运算符的含义是什么?
下一篇: C#代码中的问号是什么意思?