I've been doing a "bit" of .net development lately and i had a problem where i would get
a variable of type object and it's type in a string. So I wondered how to convert it to proper type at runtime.
The solutions is one of those things that is unbeliveably hard to find because you don't really know what
to search for, but when you find it, it seems unbeliveably simple. :)
Here it is:
string sType = "System.Int32";
object o1 = "123";
object o2 = Convert.ChangeType(o1, Type.GetType(sType));
Type t = o2.GetType(); // this returns Int32 Type