var gender = from row in excel.Worksheet()
select row["Gender *"].Value.ToString();
string[] genderArray = gender.ToArray().Distinct().ToArray();
in this case the content of genderArray are { “F” , “M” , “M “}
i want that genderArray should only contain { “F” , “M” }
You can also do the .Trim in the first query against Value.ToString().Trim().
Edited: I might have misplaced the select in the query.