title: MergeSort algorithm in c#
body: <p>I wrote below code for Merge Class :</p>
  
  <pre><code>class Merge
  {
  
      public static void sort(IComparable[] a)
      {
          sort(a, 0, a.Length);
      }
  
      public static void sort(IComparable[] a, int low, int high)
      {
          int N = high - low;
          if (N &lt;= 1)
              return;
  
          int mid = low + N / 2;
  
          sort(a, low, mid);
          sort(a, mid, high);
  
          IComparable[] aux = new IComparable[N];
          int i = low, j = mid;
          for (int k = 0; k &lt; N; k++)
          {
              if (i == mid) aux[k] = a[j++];
              else if (j == high) aux[k] = a[i++];
              else if (a[j].CompareTo(a[i]) &lt; 0) aux[k] = a[j++];
              else aux[k] = a[i++];
          }
  
          for (int k = 0; k &lt; N; k++)
          {
              a[low + k] = aux[k];
          }
      }
  
      private static Boolean isSorted(IComparable[] a)
      {
          for (int i = 1; i &lt; a.Length; i++)
              if (a[i].CompareTo(a[i - 1]) &lt; 0) return false;
          return true;
      }
  
  }
  </code></pre>
  
  <p>And below code is Implementation. i thought below code should't be wrong! but it's does't compile... </p>
  
  <pre><code>class Program
  {
      static void Main(string[] args)
      {
      Merge ms = new Merge();
  
      Double[] MyArray = { 80,10,52,7,36,7,67,1,8,54 };
      Console.WriteLine("first array is: \n");
      for (int k = 0; k &lt; MyArray.Length; k++)
      {
          Console.Write(MyArray[k]);
          if (k&lt;9)
             Console.Write(" , ");
      }
      ms.sort(MyArray);  // Error is here. Does't compile !!!
      Console.WriteLine("\n");
      Console.WriteLine("\nsorted array is: \n ");
      for (int k = 0; k &lt; MyArray.Length; k++)
      {
          Console.Write(MyArray[k]);
          if (k&lt;9)
             Console.Write(" , ");
      }
      Console.ReadLine();
      }
  }
  </code></pre>
  
  <p>It's does't compile. Error is in <code>ms.sort(MyArray);</code>.
  What am i doing wrong?
  Please lead me...</p>
  
  <p>Regards</p>