private static bool IsSorted(KeyValuePair<ulong,double>[] coordElemArray)
{
if(0 == coordElemArray.Length) {
return true;
}
ulong prevId = coordElemArray[0].Key;
for(int i=1; i<coordElemArray.Length; i++)
{ // <= also checks for duplicates as well as sort order.
if(coordElemArray[i].Key <= prevId) {
return false;
}
}
return true;
}