title: How do I find a value of an item in an array by Name (or value) instead of Index?
body: <p>How do I find a value of an item in an array by Name (or value) instead of Index?<br>
  For instance; get Name where <code>ID = 1</code></p>
  
  <p>I have an array of objects, in which each object has a sub-array. I want to sort alphabetically where the ID is in the parent object and the Name is in the sub-array…</p>
  
  <p>Each object in the parent array (MyObjects) is shaped like this;</p>
  
  <pre><code>Index, _itemID, _price, NamesIDs []
  </code></pre>
  
  <p>The child array in each object (MyObjects._aSingleAssignment.NamesIDs) is shaped like this;</p>
  
  <pre><code>Index, _ itemID, _name
  </code></pre>
  
  <p>I didn’t build this thing, so excuse the insanity, but the parent array has Item ID and Price, the sub-array has a list of ALL Item IDs and Names in the system…  For any given ID (parent array), how do I get its Name (sub-array)? </p>
  
  <p>I know how to get _itemID at any given index;  </p>
  
  <pre><code>MyControl _aSingleAssignment = this.MyObjects[i] as MyControl;
  int _itemID = _aSingleAssignment.ID; // The ID for the currently evaluated item
  </code></pre>
  
  <p>I know how to get the Name from any given Index in the sub-array;</p>
  
  <pre><code>string _itemName = _aSingleAssignment.NamesIDs[i].Name;
  </code></pre>
  
  <p>But how do I get the Name when given the ID instead of pulling it out by Index?  If I pull it by index I have to iterate through each item in the sub-array and do a compare.  I don’t mind iterating, but I figure there has to be an easier way.</p>
  
  <p>I want to do something like:</p>
  
  <p><code>string _itemName = _aSingleAssignment.NamesIDs[ID == _itemID].Name;</code>  </p>
  
  <p>Where is just grabs the name that matches the ID.</p>
  
  <p>The point of this exercise is to sort my parent array alphabetically instead of numerically (.sort())</p>
  
  <p>Thanks guys!</p>