title: Foreach loop through ObservableCollection
body: <p>In WPF app I use LINQ query to get values from ObservableCollection and update the state of some objects:</p>
  
  <pre><code>var shava = from clc in _ShAvaQuCollection where clc.xyID == "x02y02" select clc;
  
          switch (shava.First().Status)
          {
              case 1:
                  x02y02.Status = MyCustControl.Status.First;
                  break;
              case 2:
                  x02y02.Status = MyCustControl.Status.Second;
                  break;
             ...
           }
  </code></pre>
  
  <p>In fact, <code>xyID</code> is unique field in this ObservableCollection and its string value corresponds to names of objects in XAML (these objects are derived from a customer control <code> MyCustControl</code>).</p>
  
  <p>What I am trying to do is: </p>
  
  <p>(1) to iterate through all of the records in <code>_ShAvaQuCollection</code> and, using <code>xyID</code> field, reference each particular objects, using <code>shava</code> as a result of query to each of the record:</p>
  
  <pre><code>MyCustControl sc = (MyCustControl)this.FindName(shava.First().xyID);
  </code></pre>
  
  <p>(2) and update the state of the object, using other values from this record, for example:</p>
  
  <pre><code>           switch (shava.First().Status)
          {
              case 1:
                  sc.Status = MyCustControl.Status.First;
                  break;
              case 2:
                  sc.Status = MyCustControl.Status.Second;
                  break;
             ...
           }  
  </code></pre>
  
  <p>All these actions apart work well, but I cannot combine it to a working iteration method, something like this (it is an idea only, because I didn't manage to get a compyleable code):</p>
  
  <pre><code>public void ReadingCollection(System.Collections.Generic.IEnumerable&lt;ShowAvaQu&gt; coll)
  {
     foreach (var xyid in coll)
          {
              //do my actions (1) and (2)
          } 
  }
  </code></pre>
  
  <p>Please, help me to organize such an iteration in this last piece of code inside the foreach loop. I'm experiencing problems with understanding how to make a query to each particular record of the collection inside the loop. </p>
  
  <p>I described that all above just to make clear what I intend to do with results of such query inside this loop. </p>