I have following classes:
public class AuthenticateCustomerResponse
{
public EligiblePromotions EligiblePromotions { get; set; }
}
public class EligiblePromotions
{
public List<PromotionList> PromotionList { get; set; }
}
public class PromotionList
{
public string LineOfBusiness { get; set; }
public AuthenticatePromotions Promotions { get; set; }
}
public class AuthenticatePromotions
{
public List<AuthenticatePromotion> Promotion { get; set; }
}
public class AuthenticatePromotion
{
public string ServiceType { get; set; }
}
I want to retrieve PromotionList whose LineOfBusiness is equal to "VID" and ServiceType is equal to "SAT".
I tried following lambda expression:
PromotionList getPromotion = AuthenticateCustomerResponse.EligiblePromotions.PromotionList.Find(p => p.LineOfBusiness.ToUpper().Equals("VID")).Promotions.Promotion.Find(o=>o.ServiceType.Equals("SAT"));
but I'm getting error:
Cannot implicitly convert type 'AuthenticatePromotion' to 'PromotionList'
What am I doing wrong?
AuthenticatePromotionobject from yourPromotionlist. If you only want thePromotionList, why do you have anotherFind?