public class TestClass
{
const MyType SOMECONSTANT = null;
protected string TestString { get; set; }
}
public class MyType
{
protected string FieldA { get; set; }
}
上記のコードは有効であり、コンパイルされます。なぜC#はで参照型const
を許可するのnull
ですか?SOMECONSTANT
これは常に行われるので、どうすればこれを使用できnull
ますか?