using System;
using System.Collections.Generic;
using System.Text;
using System.Collections;

namespace KreiseSortieren
{
   public struct Kreis : IComparable
   {
      public double XWert;
      public double YWert;
      public double Radius;

      public Kreis(double x, double y, double r)
      {
         this.XWert = x;
         this.YWert = y;
         this.Radius = r;
      }

      #region IComparable Member

      public int CompareTo(object obj)
      {
         Kreis k = (Kreis)obj;
         return this.Radius.CompareTo(k.Radius);
      }

      #endregion
   }

   class Program
   {
      static void Main(string[] args)
      {
         ArrayList Kreise = new ArrayList();

         Kreise.Add(new Kreis(0, 0, 1));
         Kreise.Add(new Kreis(0, 0, 3));
         Kreise.Add(new Kreis(0, 0, 2));

         Console.WriteLine("Vor der Sortierung:");
         foreach (Kreis k in Kreise)
            Console.WriteLine("   Radius = {0}", k.Radius);

         Kreise.Sort();

         Console.WriteLine("Nach der Sortierung:");
         foreach (Kreis k in Kreise)
            Console.WriteLine("   Radius = {0}", k.Radius);
      }
   }
}
