Home All Groups Group Topic Archive Search About

Anyway to convert an object type using a System.Type?

Author
11 Apr 2005 6:50 PM
Don
Is there anyway to convert an object from one type to another using either a
System.Type object containing the desired type to convert to or a string
variable containing the name of the type to convert to?

- Don

Author
11 Apr 2005 7:19 PM
Mattias Sjögren
>Is there anyway to convert an object from one type to another using either a
>System.Type object containing the desired type to convert to or a string
>variable containing the name of the type to convert to?

It depends on which types you're dealing with. The
System.ComponentModel.TypeConverter class may be useful.



Mattias

--
Mattias Sjögren [MVP]  mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.
Author
11 Apr 2005 7:39 PM
Don
"Mattias Sjögren" <mattias.dont.want.spam@mvps.org> wrote in message
news:eyYKctsPFHA.2724@TK2MSFTNGP10.phx.gbl...
> >Is there anyway to convert an object from one type to another using
either a
> >System.Type object containing the desired type to convert to or a string
> >variable containing the name of the type to convert to?
>
> It depends on which types you're dealing with. The
> System.ComponentModel.TypeConverter class may be useful.

I'm dealing with custom classes.