Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save maurosampietro/7d95ccc1ccdd040169e5fe303b87e60d to your computer and use it in GitHub Desktop.
Save maurosampietro/7d95ccc1ccdd040169e5fe303b87e60d to your computer and use it in GitHub Desktop.
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