I am using dictionary to collect some information. After I collect the details I need to sort the dictionary values based on the key using var Variable. After that I need to insert the sorted var variable to the new dictionary. Here, I have trouble to insert the sorted data into dictionary.
I'm posting my code Here:
var orderDic = from dic in dictionaryColl
orderby dic.Key ascending
select dic;
Dictionary<int, string> newDic = new Dictionary<int, string>();
newDic =(Dictionary<int,string>)orderDic; // Here i'm not able to assign data to dictionary
Thanks in Advance..