Automapper - concrete object to array
I need to map some values from a class to an array. For example: public class Employee { public string name; public int age; public int cars; } must be converted to [age, cars] I tried with this var employee = new Employee() { name = "test", age = 20, cars = 1 }; int[] array = new int[] {}; Mapper.CreateMap<Employee, int[]>() .ForMember(x => x, options => { options.MapFrom(source => new[] { source.age, source.cars }); } ); Mapper.Map(employee, array); but i get this error: Using mapping configuration for Employee to System.Int32[] Exception of type 'AutoMapper.AutoMapperMappingException' was