Do value types (Integer, Decimal, Boolean, etc…) inherit from Object?

前端 未结 8 2077
梦谈多话
梦谈多话 2020-12-03 14:59

Looking for clarification on this...

I\'ve heard that \'everything\' in .Net inherits from Object. I\'ve also heard that the difference between value types and refe

8条回答
  •  时光说笑
    2020-12-03 15:20

    Value types, such as Int32, are structs.

    From the VS 2008 C# help file (since I had it open) on structs:

    A struct cannot inherit from another struct or class, and it cannot be the base of a class. All structs inherit directly from System.ValueType, which inherits from System.Object.

提交回复
热议问题