I have a string property that I am trying to split by ','
below is the code for the mapping
CreateMap<eCenterService.Domain.StudentExamPreparation, StudentExamPreparationDto>()
.ForMember(
des => des.DoesTheStudentPlanToTakeExam,
m => m.MapFrom(src => !string.IsNullOrEmpty(src.DoesTheStudentPlanToTakeExam)
? src.DoesTheStudentPlanToTakeExam
.Split(new char[','], System.StringSplitOptions.RemoveEmptyEntries)
: null));
I am tring to get something like :
"doesTheStudentPlanToTakeExam": [ "SAT", "UNDECIDED" ]
but what I keep getting is:
"doesTheStudentPlanToTakeExam": [ "S", "A", "T", ",", " ", "U", "N", "D", "E", "C", "I", "D", "E", "D" ]
what am I doing wrong?