public struct PLU { public int ID { get; set; } public string name { get; set; } public double price { get; set; } public int quantity {get;set;} } public static ObservableCollection<PLU> PLUList = new ObservableCollection<PLU>();
I have an ObservableCollection as above. Now I want to find the identifier in PLUList and get its index as follows:
int index = PLUList.indexOf(); if (index > -1) { // Do something here } else { // Do sth else here.. }
What is the quick fix?
EDIT:
Suppose some elements have been added to the PLUList, and I want to add another new element. But before adding, I want to check if an identifier exists in the list. If this happens, I would like to add +1 to the quantity.
source share