I am trying to use a lambda expression to remove a specific object from a list based on the value inside that object. Here is my lambda:
ChartAttributes.ToList().RemoveAll(a => a.AttributeValue.Contains("PILOT"));
Here is a list of ChartAttributes
IList<IChartAttribute> ChartAttributes
Here is the ChartAttribute object contained in the above list
public virtual string AttributeKey { get; set; } public virtual string AttributeValue { get; set; } public virtual int ChartAttributeId { get; set; } public virtual int ChartSpecificationId { get; set; }
There is a chart attribute with its AttributeKey attribute set to "PILOT". But it is never deleted. What am I doing wrong?
thanks
source share