How to convert string to any type

Solution 1:

using System.ComponentModel;

TypeConverter typeConverter = TypeDescriptor.GetConverter(propType);
object propValue = typeConverter.ConvertFromString(inputValue);

Solution 2:

Try Convert.ChangeType

object propvalue = Convert.ChangeType(inputValue, propType);

Solution 3:

I don't really think I understand what your are trying to archieve, but.. you mean a dynamic casting? Something like this:

 TypeDescriptor.GetConverter(typeof(String)).ConvertTo(myObject, typeof(Program));

Cheers.