If you are using System.Windows.Point
data type to represent a point, you can use
// assuming p1 and p2 data types
Point p1, p2;
// distanc can be calculated as follows
double distance = Point.Subtract(p2, p1).Length;
Update 2017-01-08:
Point.Subtract
is System.Windows.Vector and it has also property LengthSquared
to save one sqrt
calculation if you just need to compare distance.WindowsBase
assembly may be needed in your projectExample with LengthSquared
and operators
// assuming p1 and p2 data types
Point p1, p2;
// distanc can be calculated as follows
double distanceSquared = (p2 - p1).LengthSquared;