title: using for loops in C# for iterating through the master data
body: <p>I wanted to suggestion on the best practices in coding for a real scenario.
  The scenario is this:
  I have a list of 100 items.</p>
  
  <pre><code>public CustomObject 
  {
      public int id {get;set;}
      public string name {get;set;}
  }
  
  List&lt;CustomObject&gt; lstObj = new List&lt;CustomObject&gt;();
  </code></pre>
  
  <p>lstobj can have sample values such as </p>
  
  <blockquote>
    <p>A,1 B,2  C,3  C,4  C,5 etc</p>
  </blockquote>
  
  <p>Now, I have a tabular data as follows:</p>
  
  <blockquote>
  <pre><code>      Low  High
  A     10   100
  Z     89   100
  </code></pre>
  </blockquote>
  
  <p>while looping through the list, I need to check against this data, and if suppose A value is more than 100 I need to put it to some xml file.</p>
  
  <p>Now, my approach is </p>
  
  <p>a) I will be putting this master data into a list formatfor eg:</p>
  
  <pre><code>public class CheckValues
  {  
      public string name { get;set;}
      public int lowerlimit { get;set;}  
      public int upperlimit {get;set;} 
  }
  </code></pre>
  
  <p>and populating the list with the data like </p>
  
  <blockquote>
  <pre><code>    Low  High
  A   10   100
  Z   89   100
  </code></pre>
  </blockquote>
  
  <p>b) using a foreach loop , I will be looping the lstobj items and within this each iteration , I would be once again iterating the list to check if the item exists and if it exists whats the value (max or min)</p>
  
  <p>Basically I am using the two forloops. Is it approach acceptable or is there any best practices/suggestions to improve the practice advisable on this?</p>