Everything about Type
is reflective in nature. Is it because Type
is used more often than the rest of the classes in System.Reflection
? Or because it functions more like a system class than a reflection class?
In short, I've always wondered what the motivation behind the location of System.Type
was.
The Type class is used in a lot more places, not just System.Reflection. A quick search with Reflector reveals hundreds of them. It is crucial in System.Configuration, System.Data, System.Drawing, System.Linq, System.Windows.Forms, etc. The way the Type instance is actually used in these classes isn't visible. It is likely that System.Reflection is used but that's an implementation detail that in no way affects the program.
Given that creating the Type instance that these classes need is trivial with the typeof operator and object.GetType and that you never have to use System.Reflection unless you actually write reflection code, Type certainly deserves an easily accessible location in the System namespace.
An assembly has types and Assembly
lies on System.Reflection
which is curious.
So my guess would be that it has something to do with Object
implementing the method GetType
which returns a Type
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With