public virtual void Set(object value) { TValue toSet; if (value is TValue) { toSet = (TValue)value; } else { toSet = (TValue)Convert.ChangeType(value, typeof(TValue)); } setter.Invoke(toSet); }
public virtual void Set(object value) { TValue toSet; if (value is TValue) { toSet = (TValue)value; } else { Structure newValue = Structure.FromPrimitiveWithAssert(value); // Handles converting built in types to Structures that Convert.ChangeType() can't. toSet = (TValue)Convert.ChangeType(newValue, typeof(TValue)); } setter.Invoke(toSet); }
public virtual void Set(object value) { var toSet = (TValue)Convert.ChangeType(value, typeof(TValue)); setter.Invoke(toSet); }