title: How to get minimum and maximum value from array list C#
body: <p>So i know how to calculate the avg but i dont know how to calculate the min and max value. I'm pretty sure you need to use a for loop but i don't know how to.</p>
  
  <pre><code> public Int32 Average
  {
      get
      {
          clsSimpleDataConnection Datalayer = new clsSimpleDataConnection();
          List&lt;Int32&gt; saleslist = new List&lt;Int32&gt;();
          saleslist = Datalayer.LoadIntegerList();
          Int32 AnItem;
          Int32 Total = 0;
          Int32 average;
          Int32 itemcount;
          itemcount = saleslist.Count;
          Int32 index = 0;
  
          while (index &lt; itemcount)
          {
              AnItem = saleslist[index];
              Total = Total + AnItem;
              index++;
  
          }
              average = Total / itemcount;
          return average;
  
  
      }
  }
  </code></pre>
  
  <p>How would i edit this so that it would calculate the min and max?</p>