为什么 ValueTuple 不能是常量?

Why can ValueTuple not be const?

声明为字段的 ValueTuple 类型可以是可变的:

class Foo {
  (int, int) bar = (0, 1);
}

或只读:

class Foo {
  readonly (int, int) bar = (0, 1);
}

并且此(im)可变性适用于每个成员。我希望它也可以扩展为 const 声明:

class Foo {
  const (int, int) bar = (0, 1);
}

但是这个语句不编译。 是否存在某些情况下它是不受欢迎的功能,或者它只是未实现的功能?

编辑 好的我现在明白了。我的问题是基于 C# 编译器对待 ValueTuples 不同于其他类型的假设,关于关键字 readonly。所以,如果它已经是一个异常,为什么不为 consts 做另一个异常。但是,事实上,这个逻辑似乎适用于所有结构。所以这行不通:

class Foo {
  readonly ExampleStruct field;
  void Method() {
    field.structField = 2;
  }
}
struct ExampleStruct {
  public int structField;
}

类型有限,可以在 c# 中用作 const (more detailed here)。

Value tuple根本不在其中