Is int (Int32) considered an object in .NET or a primitive (not int?)?

前端 未结 6 1821
小蘑菇
小蘑菇 2020-12-31 20:19

Is int (aka Int32) an object , or a primitive in .NET (I\'m not asking regarding int?)?

I hit F12 on the saved word int and g

6条回答
  •  渐次进展
    2020-12-31 20:48

    Everything in C# inherits from object, including int.

    From msdn:

    Int32 is an immutable value type that represents signed integers

    and

    Both reference and value types are derived from the ultimate base class Object.

提交回复
热议问题