0

IDE has suggested the following Syntax change

while ((line = sr.ReadLine()) != null)

           while (sr.ReadLine() is { } line)
            {
                output += line + "\n";
            }

Must be a relatively new C# feature, but I am unable to find documentation of this "syntactic sugar" anywhere, involving the { }. I understand what it does but is there any doc anywhere? I found this but does not seem to be appearing https://learn.microsoft.com/en-US/dotnet/csharp/language-reference/operators/patterns#list-patterns

Sergioet
  • 1,108
  • 13
  • 27
  • Maybe you can find more when you search `property pattern` [documentation](https://learn.microsoft.com/en-US/dotnet/csharp/language-reference/operators/patterns#property-pattern) – Lazar Đorđević Oct 12 '22 at 17:12
  • https://stackoverflow.com/questions/62139886/meaning-of-curly-braces-after-the-is-operator – Nikki9696 Oct 12 '22 at 17:14

0 Answers0