
In C# the question mark has 5 meanings as of C# 8.
- Ternary operators
(true ? "true": "false")
2. Null conditional operator
items?.Count()
3. Nullable types (this should be rebranded as nullable value types)
int?
4. Null-coalescing operator
isnull ?? string.Empty
5. Nullable reference types
string?
作者:Chuck Conway 专注于软件工程和生成式人工智能。在社交媒体上与他联系:X (@chuckconway) 或访问他的 YouTube。