Parsing values from XML into types of Type
Posted
by DrLazer
on Stack Overflow
See other posts from Stack Overflow
or by DrLazer
Published on 2010-05-12T13:44:14Z
Indexed on
2010/05/12
13:54 UTC
Read the original article
Hit count: 154
c#
|reflection
check this out
Type configPropType = configurableProp.getPropertyType();
string attValue = xmlelement.GetAttribute(configurableProp.getName());
configProps[configurableProp.getName()] = attValue;
At the point where I am setting the value that got read in from XML it turns out the assigning object needs to be parsed to the correct type for it to work. I need something like.
configProps[configurableProp.getName()] = configPropType.ParseToThisType(attValue);
Looked around on msdn but its a very confusing place.
© Stack Overflow or respective owner