public static int CmpCrg_CphGIDTypeIndex(CRegion crg1, CRegion crg2) { int intResult = crg1.GetCphCount().CompareTo(crg2.GetCphCount()); if (intResult == 0) { intResult = crg1.intSumCphGID.CompareTo(crg2.intSumCphGID); } if (intResult == 0) { intResult = crg1.intSumTypeIndex.CompareTo(crg2.intSumTypeIndex); } if (intResult == 0) { //this will compare the GID of every CPatch in the two SortedDictionary intResult = CCmpMethods.CmpWithSameElements(crg1.GetCphCol(), crg2.GetCphCol(), cph => cph); } if (intResult == 0) { intResult = CCmpMethods.CmpWithSameElements(crg1.GetCphTypeIndexCol(), crg2.GetCphTypeIndexCol(), intTypeIndex => intTypeIndex); } return(intResult); }