我到处都找不到。你能告诉我表达式 { } 在 C# 中的含义吗?或者给我一个文档链接。
这是我在我的项目中找到的示例用法:
Method(IProfileDocument profileDocument)
{
if(profileDocument.documentId is not { } documentId
|| string.IsNullOrEmpty(documentId))
{
do something...
}
}
最佳答案
{ }
与 is
一起使用时是空属性模式。
{ }
基本上等同于 != null
关于C# { } 运算符,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/73698025/