/// <summary>
 /// Help method to decide which
 /// shape type a GeometricThing is.
 /// Sends object to the object's GetPerimeter().
 /// </summary>
 /// <param name="thing"></param>
 /// <returns>0 if thing is null or not suitable, or perimeter value.</returns>
 public float GetPerimeter(GeometricThing thing)
 {
     if (thing != null)
     {
         var shape = SetObject(thing);
         return(shape.GetPerimeter());
     }
     return(0);
 }
 /// <summary>
 /// Sets a GeometricThing to a definite shape object.
 /// </summary>
 /// <param name="thing"></param>
 /// <returns>a definite object of the abstract class GeometricThing</returns>
 private GeometricThing SetObject(GeometricThing thing)
 {
     if (thing is Rectangle rectangle)
     {
         return(rectangle);
     }
     if (thing is Square square)
     {
         return(square);
     }
     if (thing is Triangle triangle)
     {
         return(triangle);
     }
     if (thing is Circle circle)
     {
         return(circle);
     }
     return(null);
 }