Reputation: 3113
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.
Upvotes: 0
Views: 59
Reputation: 5256
Looks like what you are trying to do is accomplished with something along these lines:
configProps[configurableProp.getName()] =
Convert.ChangeType(attValue, configPropType);
Upvotes: 2