The SelectMany() method is designed to project multiple arrays (in fact, everything that implements IEnumerable<T> ) into one array.
For example, if you have a list of AutoBody elements, and you want to copy all the Vehicles associated with it into one array, you should do:
IEnumerable<Vehicles> vehicles = autoBodies.SelectMany(x => x.Vehicles);
But when you use SelectMany in the string property ( Color in your case), you basically project string into IEnumerable<char> (since string implements IEnumerable<char> because it is actually a sequence of characters).
Try using Select() instead:
List<string> uniqueColors = autoBody.Select(auto => auto.SelectedCar.Color) .Distinct() .ToList()
See MSDN
source share