Does every C# type derive from object?

An important correction of wide-spread myth: every type in C# derives from object. To summarize, 3 types do not derive from object: unsafe pointer types, interfaces and generic types.

 

The last two types are convertible to object, however. As any expression having interface type at compile type will have a runtime value representing by some instance, it is always convertible to object. Similar for generics. But it's incorrect to say interfaces derive from object as they cannot derive from a class, only from other interfaces.

 

The full article is available at: http://blogs.msdn.com/ericlippert/archive/2009/08/06/not-everything-derives-from-object.aspx

Thank you for your interest!

We will contact you as soon as possible.

Send us a message

Oops, something went wrong
Please try again or contact us by email at info@tikalk.com