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); }
public static int CmpColConsideringCount <T, TOrder>(ICollection <T> pCol1, ICollection <T> pCol2, Func <T, TOrder> orderFunc = null, IComparer <TOrder> cmp = null, bool blnReverse = false) { int intResult = pCol1.Count.CompareTo(pCol2.Count); if (intResult == 0) { intResult = CCmpMethods.CmpWithSameElements(pCol1, pCol2, orderFunc, cmp); } if (blnReverse == true) { intResult = intResult * -1; } return(intResult); }