/// <summary> /// Returns an ordered dictionary in inverted order. /// </summary> /// <returns></returns> public IOrderedDictionary <TK1, TV1> Invert() { return(new TransformOrderedDictionary <TK1, TV1, TK2, TV2>( _subDictionaryOrdered.Invert(), KeyOut, KeyIn, ValueOut, ValueIn)); }
/// <summary> /// NOTE: Code-generation-invoked method, method name and parameter order matters /// </summary> /// <param name="sort">sorted</param> /// <param name="hasColl">collection flag</param> /// <param name="descending">true for descending</param> /// <returns>collection</returns> public static ICollection <T> EnumOrderBySortEval <T>( IOrderedDictionary <object, ICollection <T> > sort, bool hasColl, bool descending) { IDictionary <object, ICollection <T> > sorted = descending ? sort.Invert() : sort; // if (!hasColl) { // return sorted.Values; // } var coll = new ArrayDeque <T>(); foreach (var entry in sorted) { coll.AddAll(entry.Value); } return(coll); }