Point2D p = new Point2D(); p.X = 1.0; p.Y = 2.0; Console.WriteLine($"({p.X}, {p.Y})"); // Output: (1, 2)
Point2D p1 = new Point2D(); p1.X = 1.0; p1.Y = 2.0; Point2D p2 = new Point2D(); p2.X = 4.0; p2.Y = 6.0; double distance = Math.Sqrt(Math.Pow(p2.X - p1.X, 2) + Math.Pow(p2.Y - p1.Y, 2)); Console.WriteLine($"Distance: {distance}"); // Output: Distance: 5
public void DrawPoint(Point2D p) { // Draw a point at position (p.X, p.Y) } Point2D p = new Point2D(); p.X = 2.5; p.Y = 3.2; DrawPoint(p);The Point2D data structure is not part of any package or library in C#. It's a simple data structure that can be defined in any C# application or library.