What elements of the dotnet collection class class can be listed in the "order of addition" and extracted through the key?

I am fortunate that I cannot count on the order of items added to the dictionary for enumeration purposes.

Is there a class (if possible, common) to which elements can be added with the key and which can be listed in the order of addition or which can be obtained using the key?

Clarification: I do not want to list in key order. I want to list an additional order. That is, I want to be able to retrieve elements through an FIFO-based enumeration (first in the first).

+5
source share
4 answers

-, , . .

-, SortedDictionary IComparer. , . , IComparer , SortedDictionary , ( ).

C6 Generic Class Library, HashedLinkedList<KeyValuePair<T>> HashedLinkedList<T>, T . IEqualityComparer, -. , , Find(ref T x) x (, , ), T O (1) O (log n ) a SortedDictionary. , LinkedList ( , C5 IDirectedEnumerable).

, .

+3

, List, . Dictionary.

, , , , , . SortedDictionary, KeyedCollection ( , , , ).

+4

( <, > SortedDictionary <, > ) GetEnumerator(), ( SortedDictionary, ).

SortedList <, > , , MSDN, , .

0

, ( , ) . - KeyedCollection < > ! ( System.Collections.ObjectModel) keyedcollection, , . KeyedCollection , ( , - )

0

All Articles