Auf Englisch lesen

Freigeben über


PointCollection.ToString Methode

Definition

Erstellt eine String-Darstellung dieses PointCollection.

Überlädt

ToString()

Erstellt eine String-Darstellung dieses PointCollection.

ToString(IFormatProvider)

Erstellt eine String-Darstellung dieses PointCollection.

ToString()

Erstellt eine String-Darstellung dieses PointCollection.

C#
public override string ToString ();

Gibt zurück

Gibt einen String zurück, der den X-Wert und den Y-Wert der Point-Strukturen in dieser PointCollection enthält.

Beispiele

Im folgenden Codebeispiel wird veranschaulicht, wie Eine Zeichenfolgendarstellung von erstellt wird PointCollection.

C#
string pcString;

// Instantiating and initializing Point structures
Point point1 = new Point(10, 10);
Point point2 = new Point(20, 20);
Point point3 = new Point(30, 30);

// Instantiating a PointCollection 
PointCollection pointCollection1 = new PointCollection();

// Adding Points to PointCollection
pointCollection1.Add(point1);
pointCollection1.Add(point2);
pointCollection1.Add(point3);

// pointCollection1 is equal to (10,10 20,20 30,30)

// Getting a string representation of the PointCollection
pcString = pointCollection1.ToString();

// pcString is equal to "10,10 20,20 30,30"

Gilt für:

.NET Framework 4.8.1 und andere Versionen
Produkt Versionen
.NET Framework 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9

ToString(IFormatProvider)

Erstellt eine String-Darstellung dieses PointCollection.

C#
public string ToString (IFormatProvider provider);

Parameter

provider
IFormatProvider

Kulturspezifische Formatierungsinformationen.

Gibt zurück

Gibt einen String zurück, der den X-Wert und den Y-Wert der Point-Strukturen in dieser PointCollection enthält.

Beispiele

Das folgende Codebeispiel zeigt, wie Sie eine Zeichenfolgendarstellung von abrufen PointCollection.

C#
string pcString;

// Instantiating and initializing Point structures
Point point1 = new Point(10, 10);
Point point2 = new Point(20, 20);
Point point3 = new Point(30, 30);

// Instantiating a PointCollection 
PointCollection pointCollection1 = new PointCollection();

// Adding Points to PointCollection
pointCollection1.Add(point1);
pointCollection1.Add(point2);
pointCollection1.Add(point3);

// pointCollection1 is equal to (10,10 20,20 30,30)

// Getting a string representation of the PointCollection
pcString = pointCollection1.ToString();

// pcString is equal to "10,10 20,20 30,30"

Gilt für:

.NET Framework 4.8.1 und andere Versionen
Produkt Versionen
.NET Framework 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9