Does every type in .net inherit from System.Object? [duplicate]

Eric Lippert has covered this in a blog entry: Not everything derives from object (This is the title of the blog entry; not the answer to this question. Don’t get confused.)

Yes, all structs inherit from System.ValueType which in turn inherits from System.Object. enums you declare inherit from System.Enum which inherits from System.ValueType.

Update:

Inherently, there’s not a problem with a value type being derived from a reference type. Inheritance is a “is-a” relationship between two types. However, in order to treat a value type as an object instance, it has to be boxed. This is done implicitly when you are passing a value to a method that expects an object parameter (or when you call instance methods implemented in System.Object.)

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)