예제 #1
0
        public int CompareTo(object obj)
        {
            Figure f = (Figure)obj;

            if (this.Area() < f.Area())
            {
                return(-1);
            }
            else if (this.Area() == f.Area())
            {
                return(0);
            }
            else
            {
                return(1);
            }
        }
예제 #2
0
        public int CompareTo(object obj)
        {
            Figure p = (Figure)obj;

            if (this.Area() > p.Area())
            {
                return(1);
            }
            else if (this.Area() < p.Area())
            {
                return(-1);
            }
            else if (this.Area() == p.Area())
            {
                return(0);
            }
            else
            {
                throw new NotImplementedException();
            }
        }
예제 #3
0
파일: Program.cs 프로젝트: EgorDudyrev/BKIT
        public int CompareTo(object obj)
        {
            if (obj == null)
            {
                return(1);
            }

            Figure fig = obj as Figure;

            if (fig != null)
            {
                return(this.Area().CompareTo(fig.Area()));
            }
            else
            {
                throw new ArgumentNullException("Object is not a Figure");
            }
        }
예제 #4
0
파일: Figure.cs 프로젝트: Igormamman/BCIT
      public int CompareTo(Object obj)
      {
          if (obj == null)
          {
              return(1);
          }
          Figure com = (Figure)obj;

          if (com != null)
          {
              return(Area().CompareTo(com.Area()));
          }
          else
          {
              Console.WriteLine("obj is not a Figure");
              return(1);
          }
      }