string Firstname { get; }
public class EntityA : IEntity
public class EntityB : IEntity
public class ModelA : IModel
public class ModelB : IModel
public static string Foo<E, M>(E entity, M model)
public static string Foo(EntityA entity, ModelA model)
return string.Format("Method 1 : {0} {1}", entity.Firstname, model.Surname );
public static string Foo(EntityB entity, ModelA model)
return string.Format("Method 2 : {0} {1}", entity.Firstname, model.Surname );
public static string Foo(EntityA entity, ModelB model)
return string.Format("Method 3 : {0} {1}", entity.Firstname, model.Surname );
public static string Foo(EntityB entity, ModelB model)
return string.Format("Method 4 : {0} {1}", entity.Firstname, model.Surname );
public static void Main()
Console.WriteLine( Foo(ea, ma) );
Console.WriteLine( Foo(eb, ma) );
Console.WriteLine( Foo(ea, mb) );
Console.WriteLine( Foo(eb, mb) );