public class Product
{
public string Name {set; get;}
public string Type {set; get;}
}
public class ProductType
{
public string Name{get;set}
}
var products = GetProducts();
var productTypes = GetProductTypes();
bool isValid = products.All(x=>x.Type == ??) // Help required
I want to make sure that all products in the ‘products’ belong to only of the product type.
How could achieve this in linq. Any help is much appreciated I am struck with LINQ stuff ?
Thanks.
You can check if all items have the same type as the first item: