Created
May 4, 2017 09:38
-
-
Save maurosampietro/7d95ccc1ccdd040169e5fe303b87e60d 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
using System; | |
namespace ClassLibrary1 | |
{ | |
public interface I | |
{ | |
int MyProperty { get; set; } | |
} | |
public class IA : I | |
{ | |
public int MyProperty { get; set; } | |
} | |
public class IB : I | |
{ | |
public int MyProperty { get; set; } | |
} | |
public class MyType | |
{ | |
public I Interface { get; set; } | |
} | |
public class Program | |
{ | |
public static void Main( string[] args ) | |
{ | |
var source = new MyType() { Interface = new IB() { MyProperty = 1 } }; | |
AutoMapper.Mapper.Initialize( cfg => { } ); | |
var target = AutoMapper.Mapper.Map<MyType>( source ); | |
bool result = Object.ReferenceEquals( source.Interface, target.Interface ); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment