public class MappingProfile : Profile
{
public MappingProfile()
{
CreateMap(typeof(Source<>), typeof(Destination<>));
}
}
public class Source
{
public T Value { get; set; }
}
public class Destination
{
public T Value { get; set; }
}
// ...
var config = new MapperConfiguration(cfg => cfg.AddProfile());
IMapper mapper = config.CreateMapper();
var source = new Source { Value = 42 };
var destination = mapper.Map, Destination>(source);
Console.WriteLine(destination.Value); // Output: 42