I\'m trying to use the .Contains()
function on a list of custom objects
This is the list:
List CartProducts = new Lis
You need to create a object from your list like:
List lst = new List();
CartProduct obj = lst.Find(x => (x.Name == "product name"));
That object get the looked value searching by their properties: x.name
Then you can use List methods like Contains or Remove
if (lst.Contains(obj))
{
lst.Remove(obj);
}