I have:
Dictionary<int, int> Color_Count = new Dictionary<int, int>();
and also: var sortedDict = from entry in Color_Count orderby entry.Value descending select entry;
But I don't know how to fix this compiler error. When I am trying to copy keys from this dictionary to integer massive, like this:
int[] Colors_massive = sortedDict.Keys.ToArray();
It cause error CS1061:
'System.Linq.IOrderedEnumerable<System.Collections.Generic.KeyValuePair<int,int>>' does not contain a definition for 'Keys' and no extension method 'Keys' accepting a first argument of type 'System.Linq.IOrderedEnumerable<System.Collections.Generic.KeyValuePair<int,int>>' could be found (are you missing a using directive or an assembly reference?)
If I am trying to copy, using other method:
int[] Colors_massive = new int[sortedDict.Keys.Count];
sortedDict.Keys.CopyTo(Colors_massive, 0);
It also cause same error, but now error is printed twice. If I replace word 'Keys' in code, for word 'Values', it also prints the same error, but now compiler cannot find the definition for 'Values'.
What am I doing wrong here?