Type class

Type class

Type class is an essential class to use while working with a Reflection. Using Type class we can access assembly, module or type run-time information. Accessing these information is simple:

First approach is to use Type’s GetType method. This approach is used if we do not have assembly loaded in our solution. Notice that Type.GetType expects string value, also you need to provide fully qualified name (namespace.typeName).

Second approach would be using typeof operator. Usage is very simple, type keyword typeof followed by Type name in parentheses.

Third approach is convenient if you already have instance of a type. Simply use GetType method. In C# everything is inheriting Object class there fore everything is a class and thus inherits GetType method.

I have acquired type object. What do i do with it now?

Now you can start to use Reflection 🙂 Next post will explain how you can access types Properties.



  1. Ah, i see. Well th’tas not too tricky at all!”

    • NoKii

      02/03/2017 at 14:31

      Thank you for your comment! IF you have some questions about other topics or you wish me to write article about some topic please do send me a message.

Leave a Reply

Your email address will not be published.


© 2021 LearnC#WithDarko

Theme by Anders NorenUp ↑