Re: Dynamically determine and cast type

Steve Johnson <[email protected]>
Newsgroups gmane.comp.windows.devel.dotnet.clr
Message-ID <[email protected]>
On Nov 16, 2007 3:13 AM, Brady Kelly <[email protected]> wrote:
> I want to write a method that takes a Property object and a string as
> parameters, and based on the type of the property, converts the string to
> the correct type, with a null for empty strings, and assigns in to the
> property.  I don't like the idea of using a switch, so how could I go about
> this?

Convert.ChangeType(object, type)

--
Steve Johnson

===================================
This list is hosted by DevelopMentor®  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.