Wednesday, 21 August 2013

Using SetValue with implicit conversion

Using SetValue with implicit conversion

Essentially, I'm trying to use
field.SetValue(obj, val);
Where val's type can be implicitly converted to the true field type, but
isn't 'directly' assignable. Of course, I get the usual ArgumentException:
Object type cannot be converted to target type. Is there a way to do this
without manually finding and calling the constructor?

No comments:

Post a Comment