<"Jim" <ssss>> wrote:[color=blue]
> how do I convert a string representation of a system.Type into a System.Type
> object?[/color]
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.
if you know the fullname of the type, you can get the type like that.
Type myType1 = Type.GetType("S ystem.Int32");
regards
"Jim" <ssss> wrote in message news:OASElfjkDH A.644@TK2MSFTNG P11.phx.gbl...[color=blue]
> how do I convert a string representation of a system.Type into a[/color]
System.Type[color=blue]
> object?
>
> Cheers
>
> Earth Worm Jim
>
>[/color]
Jon Skeet [C# MVP] <skeet@pobox.co m> wrote:[color=blue]
> <"Jim" <ssss>> wrote:[color=green]
> > how do I convert a string representation of a system.Type into a System.Type
> > object?[/color]
>
> 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.[/color]
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.Window s.Forms.Form") will return null, for
instance. If your string contains the full assembly information, that's
used appropriately - otherwise you can use Assembly.GetTyp e if you know
the assembly which contains the type you're after.
Comment