public int Compare(object x, object y) { ITableMap tbl1 = x as ITableMap; if (tbl1 == null) { throw new Exception(String.Format("Can only compare instances of ITableMap, passed in parameter was {0}!", x.GetType().ToString())); } ITableMap tbl2 = y as ITableMap; if (tbl2 == null) { throw new Exception(String.Format("Can only compare instances of ITableMap, passed in parameter was {0}!", y.GetType().ToString())); } return(tbl1.GetLockIndex().CompareTo(tbl2.GetLockIndex())); }