Tag Archives: Reflection

Type.GetType()

Browsing through ASP.NET Forums, I found an interesting questions raised by a member that when he tried to get type information of a class using Type.GetType it was a charm in C#, but VB did not worked in same manners. He was trying to create new instances of that class at runtime, and populate those instances with data fetched from any database.

I checked its documentation in MSDN, here are its salient points, which should always be thought out before using this.

It accepts only a parameter which must contain an assembly qualified name of required type. This parameter could be only type name (i.e. "Contact") or may include namespace in it (i.e. "Hansvits.Models.Contact").

If parameter has only type name then method will search only in the assembly in which that call was made. If any full/partial assembly name is mentioned then it will load that assembly and search in it.

Continue reading