Here's a simple implementation for calculating the Euclidean distance between two points in C#:
main.cs403 chars17 lines
This method takes in two double arrays representing the coordinates of two points and returns their Euclidean distance. It first checks to make sure that the points are of the same dimensionality, then calculates the squared distance between each corresponding dimension of the points. Finally, it takes the square root of the sum of the squared differences to obtain the actual distance.
gistlibby LogSnag