csharp-3/extension-methods/PointExtensions.cs - The static class PointExtensions. | Lecture 5 - slide 28 : 29 Program 3 |
using System; public static class PointExtensions{ public static double DistanceTo(this Point p1, Point p2){ return Math.Sqrt((p1.X - p2.X) * (p1.X - p2.X) + (p1.Y - p2.Y) * (p1.Y - p2.Y)); } }