csharp> int x = 42;
csharp> fixed (int* p = &x) {
> object o = p;
> }
(2,16): error CS0029: Cannot implicitly convert type `int*' to `object'
csharp> typeof(int*).BaseType
null
object
言語設計者がポインター型を(参照型や値型とは異なり)サブタイプにしないことを選択したのはなぜですか? またはカスタムクラスを使用IntPtr
せずにポインターをボックス化する方法はありますか?UIntPtr