public static void CopyProp( this object sourceObj, string sourcePropName, object targetObj, string targetPropName = null, IValConverter converter = null ) { object sourcePropValue = sourceObj; if (sourcePropName != null) { sourcePropValue = GetPropValue(sourceObj, sourcePropName); } object targetPropValue = sourcePropValue; if (converter != null) { targetPropValue = converter.Convert(sourcePropValue); } if (targetPropName == null) targetPropName = sourcePropName; ReflectionUtils.SetPropValue(targetObj, targetPropName, targetPropValue); }
public static void CopyProp ( this object sourceObj, string sourcePropName, object targetObj, string targetPropName = null, IValConverter converter = null ) { object sourcePropValue = sourceObj; if (sourcePropName != null) { sourcePropValue = GetPropValue(sourceObj, sourcePropName); } object targetPropValue = sourcePropValue; if (converter != null) { targetPropValue = converter.Convert(sourcePropValue); } if (targetPropName == null) { targetPropName = sourcePropName; } ReflectionUtils.SetPropValue(targetObj, targetPropName, targetPropValue); }
ToDelegate <InputType, OutputType> ( this IValConverter <InputType, OutputType> converter ) { if (converter == null) { return(null); } return(converter.Convert); }