■ C# 10.0 での新機能
・拡張プロパティのパターン (Extended property patterns)
https://docs.microsoft.com/ja-jp/dotnet/csharp/language-reference/operators/patterns#property-pattern
パターンマッチングの機能強化。プロパティの中のオブジェクトのプロパティをシンプルな記述でパターンマッチングできる。
SampleA a = new(); // プロパティの中のプロパティをシンプルに書ける if (a is SampleA { PropertyA.PropertyB: 1 }) { } // 構造体定義 struct SampleA { public SampleB PropertyA { get; set; } } struct SampleB { public int PropertyB { get; set; } }