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());
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With