我在任何地方都找不到它。您能否告诉我表达式{ }在 C# 中的含义,或者给我一个文档链接。
这是我在项目中找到的示例用法:
Method(IProfileDocument profileDocument)
{
if(profileDocument.documentId is not { } documentId
|| string.IsNullOrEmpty(documentId))
{
do something...
}
}
Run Code Online (Sandbox Code Playgroud)
{ }与 一起使用时is是一个空属性模式。
{ }基本上相当于!= null