Cast to a type from the type name as a string

I'll repeat the advice that you probably don't need to do this, but because I have done this operation before:

Convert.ChangeType(ItemToCast, Type.GetType(stringNameOfType)))

Should work for you.


I don't think you need to cast it to the derived type. You should be able to cast it to the base type and use the shared interface (be it a base class or literal Interface) to perform whatever you want done.

If not, consider adding the behavior as an interface requirement so you can do it that way.

Finally: the one possibility where you'd need to do it this way is if you're overriding the casts...in which case I'm almost certain you can't do this without some heavy duty reflection.