Reputation:
I used a struct
public struct stuff
{
public int ID;
public int quan;
}
in List<stuff> stuff = new List<stuff>();
How i can check the list already have a stuff "where ID = 1"?
Upvotes: 6
Views: 6461
Reputation: 24747
You can use LINQ very easily
bool res = stuff.Any(c => c.ID == 1);
Upvotes: 17