private ServiceContracts[] SortByPriority(ServiceContracts[] serviceFile) { for (int i = 1; i < serviceFile.Length; i++) for (int j = i; j > 0 && ((int)serviceFile[j].priority > (int)serviceFile[j - 1].priority); j--) Swap(ref serviceFile, j); return serviceFile; }
private void Swap(ref ServiceContracts[] serviceFile, int j) { var temp = serviceFile[j]; serviceFile[j] = serviceFile[j - 1]; serviceFile[j - 1] = temp; }