When we create a class Product
class Product
{
}
What I have learned from different blogs and books that Object
class is the super
When you want to explore how things happen, you can always take it one step lower and look into the emitted metadata and IL code generated for each method.
For example, this is a Person
class with one property, Name
:
public class Person
{
public string Name { get; set; }
}
When we look at the emitted IL we see (using ILSpy) :
.class public auto ansi beforefieldinit ConsoleApplication2.Person
extends [mscorlib]System.Object
{
// Property declaration removed for brevity
}
The compiler add the extends [mscorlib]System.Object
, where mscorlib
is the declared assembly, System
is the namespace and Object
is the declared type.