title: Find Minimum and Maximum values within a multi dimensional struct array
body: <p>For a school project in learning c# I am making a data collection console application which saves floating point entries for 4 different locations along with the time/date, and user who recorded the entry.  I am required to use a multi dimensional struct array.</p>
  
  <p>I need to have a view that displays the average of the values, along with the minimum and maximum values and the first and last date. I've got the average figured out by counting through the values and adding cumulatively but I can't figure out how to find the minimum and maximum values.</p>
  
  <p>I tried searching and came across this page: <a href="http://www.dotnetperls.com/max" rel="nofollow">http://www.dotnetperls.com/max</a>
  I tried to implement this syntax into my code to no avail due to it being a much more complex array.</p>
  
  <p>It worked in my test with integers:</p>
  
  <pre><code>class Program
  {
      static int[][] intarray = new int[4][] { new int[10], new int[10], new int[10], new int[10] };
      static void Main(string[] args)
      {
          intarray[0][0] = 5;
          intarray[0][1] = 3;
          intarray[0][2] = 10;
          intarray[0][3] = 4;
          intarray[0][4] = 2;
          Console.WriteLine(intarray[0].Max());
          Console.ReadLine();
      }
  }
  </code></pre>
  
  <p>The above code perfectly displays the number 10! :)</p>
  
  <p>But when I tried to implement this in to my program with a struct array, it doesn't work:</p>
  
  <pre><code>class Program
  {
      static byte location = 0;
      static float entriesmin;
      static float entriesmax;
      static Entry[][] entriesarray = new Entry[4][] { new Entry[10], new Entry[10], new Entry[10], new Entry[10] };
  
      struct Entry
      {
          public float value;
          public string user;
          public DateTime datetime;
      }
  
      static byte LoopEntries(bool display)
      {
          float runningtotal = 0;
          byte entrycount = 0;
          foreach (Entry entry in entriesarray[0])
          {
              if (entry.user != null)
              {
                  if (display)
                  {
                      string ten;
                      if (entrycount == 9)
                      {
                          ten = "  #";
                      }
                      else
                      {
                          ten = "   #";
                      }
                      Console.WriteLine(ten + (entrycount + 1) + " " + entry.datetime + " " + entry.user + new string(' ', 16 - entry.user.Length) + entry.value);
                  }
                  runningtotal += entry.value;
                  entrycount += 1;                
              }
          }
          entriesmin = (entriesarray[location]).value.Min();
          entriesmax = (entriesarray[location]).value.Max();            
          if (entrycount == 0 &amp;&amp; display)
          {
              Console.WriteLine("No entries to show!");                
          }
          return entrycount;
      }
  </code></pre>
  
  <p>I need to hand this project in on Monday! I really hope someone can help me! ;)</p>