Moo.Core.PropertyConverter.Convert C# (CSharp) Method

Convert() public method

Performs conversion between the two properties.
public Convert ( object source, PropertyInfo sourceProperty, object target, PropertyInfo targetProperty ) : void
source object The source.
sourceProperty System.Reflection.PropertyInfo Property in the origin.
target object The target.
targetProperty System.Reflection.PropertyInfo Property in the destination.
return void
        public void Convert(
            object source,
            PropertyInfo sourceProperty,
            object target,
            PropertyInfo targetProperty)
        {
            Convert(source, sourceProperty, target, targetProperty, false);
        }

Same methods

PropertyConverter::Convert ( object source, PropertyInfo sourceProperty, object target, PropertyInfo targetProperty, bool strict ) : void

Usage Example

Exemplo n.º 1
0
 public void ConvertTestComplex()
 {
     var target = new PropertyConverter();
     var source = new TestClassA {InnerClass = new TestClassC()};
     const string expected = "test";
     source.InnerClass.Name = expected;
     var fromProperty = typeof (TestClassA).GetProperty("InnerClass");
     var targetObject = new TestClassB {InnerClassName = "wrongstring"};
     var toProperty = typeof (TestClassB).GetProperty("InnerClassName");
     target.Convert(source, fromProperty, targetObject, toProperty);
     Assert.AreEqual(expected, targetObject.InnerClassName);
     Assert.AreEqual(expected, source.InnerClass.Name);
 }
All Usage Examples Of Moo.Core.PropertyConverter::Convert