コード例 #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);
          }
      }