In listProducts I have a field called "family". I want to GroupBy this field.
var products = from listProducts in repository.All() where (listProducts.Code == "48654") select listProducts;` In listProducts I have a field called "family". I want to GroupBy this field.
var products = from listProducts in repository.All() where (listProducts.Code == "48654") select listProducts;` Try this,
var products = from listProducts in repository.All() where listProducts.Code == "48654" group listProducts by listProducts.family into grp select grp; For more information visit LINQ Group By