class A
{
public List<string> list;
}
class B
{
public string[] array;
}
How would you map this?
I've tried
CreateMap<A,B>();
That doesn't work
class A
{
public List<string> list;
}
class B
{
public string[] array;
}
How would you map this?
I've tried
CreateMap<A,B>();
That doesn't work
Your first issue is going to be that the class members don't match. If they did, I'd imagine that this would work. If not, you just have to specify your mapping rather than letting Automapper infer it:
CreateMap<A,B>()
.ForMember(d => d.array, opts => opts.MapFrom(s => s.list.ToArray());
For a shortcut, a vb.net version
CreateMap(Of A, B)().ForMember(Function(d) d.array, Sub(opts) opts.MapFrom(Function(s) s.list.ToArray()))