Hello,
Does anyone know how I can use Convert.ChangeType to cast from XML to a specific class?
For example:
My Property
public Point Loc
{
get { return GetValue<Point2D>("Loc"); }
set { SetValue<Point2D>("Loc", value); }
}
My XML:
<Loc>
<X>1.0</X>
<Y>1.0</Y>
</Loc>
Call to convert:
prop.SetValue(targetObj,
Convert.ChangeType(xmlProperty.Value, prop.PropertyType));
I have looked at using IConvertible but none of the methods are being called.
All of the examples I could find are using simple types. None show casting to an instance of a class.
Thank you,
Rick