C# 模式与 属性 的操纵值匹配

C# pattern matching with manipulated value of property

假设我有一个 class

public class Foo
{
  public int Bar { get; set; }
  
  public string Baz { get; set; }
}

我在一个变量中初始化它。

var foo = new Foo
{
  Bar = 123,
  Baz = "123"
};

是否可以将其与操作的值进行模式匹配?

因为我能做到:

if (test is { Bar: >= 100 })
{
  // do
}

有可能实现吗?

if (test is { Bar: >= 100, Baz: value.Length > 5 })
{
  // do
}

以上语法无效。

嵌套 属性 模式 {Length: > 5} 应该可以解决问题:

if (foo is { Bar: >= 100, Baz: {Length: > 5}})
{
    // do
}