PointCollection points = new PointCollection(); points.Add(new Point(0, 0)); points.Add(new Point(50, 100)); points.Add(new Point(100, 0));
Point[] pointsArray = new Point[] { new Point(0, 0), new Point(50, 100), new Point(100, 0) }; PointCollection points = new PointCollection(pointsArray);
PointCollection points = new PointCollection(); for (int i = 0; i < 10; i++) { double x = i * 10; double y = Math.Sin(i) * 50 + 50; points.Add(new Point(x, y)); }This code creates a PointCollection object by adding 10 points to it. The x coordinate of each point is incremented by 10, while the y coordinate is calculated as the sine of the x value multiplied by 50 and then added to 50. Overall, the System.Windows.Media package library is used for creating and manipulating visual elements in C# applications, and PointCollection is a useful class within the library for working with collections of points.