Reputation: 455
I'm using Automapper in a VB.NET project, and am trying to make it ignore a member. I can see how to do this in C#, but not in VB.NET. Does anyone have a quick example of using the ForMember method.
Thanks,
Paul
Upvotes: 3
Views: 2107
Reputation: 7802
Here's how you do it :)
Mapper.CreateMap(Of incomingModel, outgoingModel)().ForMember(Function(x) x.FieldToIgnore, Sub(y) y.Ignore())
The thing that is important, and likely what messed up you is the Sub instead of the function for the second part.
this also only works in vs2010. older versions you can't do it.
Upvotes: 9