.net-internals

How does the .NET runtime determine that two types are the same?

Hello, I have assembly A that depends (statically) on type T (reference type, a class) in assembly B. I do not own assembly A but I do own assembly B. T unfortunately is a real type (not an interface) but luckily A uses reflection to discover its members. I want to be able to create dynamically B (and T). The only important item is th...

Why calling some functions of the Object class, on a primitive type instance, need boxing ?

Hello, I have discovered that if i run following lines of code. int i = 7; i.GetHashCode(); //where GetHashCode() is the derived //function from System.Object No boxing is done, but if i call i.GetType() (another derived function from System.Object) in place of GetHashCode(), a boxing will be required to call GetType...

Delegates in .NET: how are they constructed ?

While inspecting delegates in C# and .NET in general, I noticed some interesting facts: Creating a delegate in C# creates a class derived from MulticastDelegate with a constructor: .method public hidebysig specialname rtspecialname instance void .ctor(object 'object', native int 'method') runtime managed { } Meaning that it exp...