I am trying to display all possible values for a sub-property. Below I am trying to get all possible colors for all products into a single variable. How can I get allDistinctColors below?
IEnumerable<Product> products = GetAllProducts();
IEnumerable allDistinctColors = ???
public class Product
{
public List<Option> Options { get; set; }
}
public class Option
{
public string Color { get; set; }
}
Use
SelectManyto select multiple output items (options) per input item (product) and concatenate them into a single enumeration for further querying: