0
if (variableName is { }) {
  // ..
}

What is the type that the expression '{ }' is giving us here? What could this be used for?

  • i've not seen this before but a quick compiler check in a somewhat older visual studio for mac (with c# 7.3) tells me it's a recursive pattern and there's a draft spec here: https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/proposals/csharp-8.0/patterns. could be worth looking into – Kris Nov 16 '22 at 08:24
  • It is the "is not null" idiom variant from before "is not" was supported. – Fildor Nov 16 '22 at 08:45

0 Answers0