示例#1
0
      static void Main(string[] args)
      {     //Creating Array of OBjects
          AreaOfCircle[] circle = new AreaOfCircle[2];
          for (int i = 0; i < 2; i++)
          {
              circle[i] = new AreaOfCircle();
          }
          //Setting Value
          circle[0].SetandGetRadius = 4.5f;
          circle[0].SetandGetColor  = "Red";
          circle[1].SetandGetColor  = "Violet";
          circle[1].SetandGetRadius = 6.0f;

          //Printing HashCode Of Objected Created
          Console.WriteLine("1st Circle HashCode: " + circle[0].GetHashCode());
          Console.WriteLine("2st Circle HashCode: " + circle[1].GetHashCode());
          CircleDetailSeperator();


          PrintCircleInfo(circle);                                          //Printing 1st circle value
          Console.WriteLine("Max Radius: " + PrintMaxCircleradius(circle)); //Printing Max Radius
          CircleDetailSeperator();

          //Printing HashCode of obj with Max Area of Circle
          Console.WriteLine("Hash Code of Max Area: {0}", PrintMaxAreaObj(circle).GetHashCode());
          Console.ReadLine();
      }
示例#2
0
 static AreaOfCircle PrintMaxAreaObj(AreaOfCircle[] RefObjArray)      //Returning  HashCode of obj with Max Area of Circle
 {
     foreach (AreaOfCircle i in RefObjArray)
     {
         if (maxarea < i.getArea)
         {
             maxarea         = i.getArea;
             returnRefToAObj = i;
         }
     }
     return(returnRefToAObj);
 }