How can I get System.Type from "System.Drawing.Color" string

Posted by jonny on Stack Overflow See other posts from Stack Overflow or by jonny
Published on 2009-06-03T12:43:08Z Indexed on 2010/04/17 23:13 UTC
Read the original article Hit count: 280

Filed under:
|
|
|

I have an xml stored property of some control

<Prop Name="ForeColor" Type="System.Drawing.Color" Value="-16777216" />

I want to convert it back as others

System.Type type = System.Type.GetType(propertyTypeString);
object propertyObj = 
  TypeDescriptor.GetConverter(type).ConvertFromString(propertyValueString);

System.Type.GetType("System.Drawing.Color") returns null.

The question is how one can correctly get color type from string

(it will be better not to do a special case just for Color properties)

Update

from time to time this xml will be edited by hand

© Stack Overflow or respective owner

Related posts about .NET

Related posts about c#