If you have a list of products and each product has a list of categories.
How to get a list of directories used by products?
List<Product> products = new List<Product>();
Product product1 = new Product();
product1.Categories.Add("Books");
product1.Categories.Add("Electronics");
Product product2 = new Product();
product2.Categories.Add("Dishes");
product2.Categories.Add("Books");
products.Add( product1 );
products.Add( product2 );
How to get a list of "Books", "Tableware", "Electronics"
source
share