Convert.ToInt32()
次のコードを確認して、との違いを教えてください。int()
なぜConvert.ToInt32
エラーが表示されるのですか?
これUserType
が列挙型です
// Showing error constant initializer must be compile time constant
const int case1 = Convert.ToInt32(UserType.Admin);
const int case2 = int(UserType.Admin);