title: How to search an item and get its index in Observable Collection
body: <pre class="lang-cs prettyprint-override"><code>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&lt;PLU&gt; PLUList = new ObservableCollection&lt;PLU&gt;();
  </code></pre>
  
  <p>I have the <code>ObservableCollection</code> as above. Now I want to search the <code>ID</code> in the <code>PLUList</code> and get its index like this:</p>
  
  <pre class="lang-cs prettyprint-override"><code>int index = PLUList.indexOf();
  if (index &gt; -1)
  {
      // Do something here
  }
  else
  {
      // Do sth else here..
  }
  </code></pre>
  
  <p>What's the quick fix?</p>
  
  <p>EDIT:</p>
  
  <p>Let's assume that some items were added to <code>PLUList</code> and I want to add another new item. But before adding I want to check if the <code>ID</code> already exists in the list. If it does then I would like to add +1 to the <code>quantity</code>.</p>