I have following classes:
public class Promotion
{
public Offers Offers { get; set; }
}
public class Offers
{
public List<PromotionOffer> Offer { get; set; }
}
public class PromotionOffer
{
public string CategoryName { get; set; }
}
And I have an object of Promotion:
Promotion applicablePromotion = promotion;
applicablePromotion contains list of Offer and each offer has CategoryName. I want to find count where CategoryName == Package
Something like:
int count = applicablePromotion.Offers.Offer.Find(c => c.CategoryName == "Package").Count;
How can I do this?