Questions tagged [property-pattern]

Pattern used in pattern matches to specify fields/properties matches

C# reference:

bool IsConferenceDay(DateTime date) =>
    date is { Year: 2020, Month: 5, Day: 19 or 20 or 21 };
1 questions
3
votes
3 answers

How to use indexers in switch expression?

How to access indexers in switch expression? There is a nice property pattern syntax in switch expressions, but I can't figure out or find any information about using indexers. Given following code: var a = "123"; if(a.Length == 3 && a[0] == '1') …
Sinatr
  • 20,892
  • 15
  • 90
  • 319