C# Reverse items in Dictionary -


I'm trying to reverse the objects in a dictionary in C # I've tried:

< Pre> dictionary & lt; Double, int & gt; Dict = new dictionary & lt; Double, int & gt; (); ... to add it to ... var v = dict.Reverse ()

However, dict.Reverse () gives me a kind IEnumberable> I'm just thinking Was that how can I make it any kind of dictionary?

Thanks in advance.

A dictionary is not an order data structure, there is no real meaning for reverse to use a SortedDictionary would be required. You can get a copy of a sorted copy by creating a new copy with a balance sheet that is sorted against the original (see).

  var reversed = new sortedDictionary (original, new reverse compaq));  

Note that reverse compressor is a fixture class for example.

In addition - you must know that the sorted objective is of some misnomer, if you consolidate the dictionary for map or hashtable . It uses binary tree implementation (red-black, I think) different algorithmically complexity compared to the hashtable implementation of the dictionary, see the comments section of their respective document pages, if performance is important, then you would want to consider that the ordering is actually Is important in


Comments

Popular posts from this blog

c# - sqlDecimal to decimal clr stored procedure Unable to cast object of type 'System.Data.SqlTypes.SqlDecimal' to type 'System.IConvertible' -

Calling GetGUIThreadInfo from Outlook VBA -

Obfuscating Python code? -