Created
October 26, 2015 13:48
-
-
Save lbargaoanu/9b0af04f49d117c57ba9 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void Main() | |
{ | |
Mapper.CreateMap(typeof(MyClass), typeof(IMyInterface)); | |
Mapper.AssertConfigurationIsValid(); | |
var myClassInstance = new MyClass { Container = 3 }; | |
var implementedClassInstance = new ImplementedClass(); | |
var obj2 = Mapper.Map(myClassInstance, typeof(MyClass), typeof(ImplementedClass)); | |
obj2.Dump(); | |
obj2 = Mapper.Map<ImplementedClass>(myClassInstance); | |
obj2.Dump(); | |
} | |
public interface IMyInterface | |
{ | |
int Container { get; set; } | |
} | |
public class ContainerClass | |
{ | |
public int MyProperty { get; set; } | |
} | |
public class ImplementedClass : IMyInterface | |
{ | |
public int Container { get;set; } | |
} | |
public class MyClass | |
{ | |
public int Container { get; set; } | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment