Jon Skeet [C# MVP] <sk***@pobox.com> wrote:
<"Jim" <ssss>> wrote: how do I convert a string representation of a system.Type into a System.Type
object?
That entirely depends on the string representation and the type
involved. If you control the type involved, you can use the
TypeConverter class to do some of the work for you - if you look up
TypeConverter in the MSDN, you'll find quite a lot of information to
help you.
Apologies - having read Ryan's answer, I see what you mean :)
Ryan's on the right track - but there is one caveat, which is that when
Type.GetType is presented with just the type name (and no assembly
information) it only looks in the current assembly and mscorlib, so
Type.GetType ("System.Windows.Forms.Form") will return null, for
instance. If your string contains the full assembly information, that's
used appropriately - otherwise you can use Assembly.GetType if you know
the assembly which contains the type you're after.
Sorry again about the previous reply...
--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too