Rectangle rect = new Rectangle(10, 20, 30, 40); Console.WriteLine(rect.ToString()); // Output: "(10, 20, 30, 40)"
Rectangle rect = Rectangle.Empty; Console.WriteLine(rect.ToString()); // Output: "{X=0,Y=0,Width=0,Height=0}"In this example, an empty rectangle object is created and the ToString method is called on it. The output shows the default values for an empty rectangle object. This method is part of the System.Drawing namespace, which is used to access classes for creating and working with graphics and images.
Converts the attributes of this
public ToString ( ) : string | ||
return | string |