c# - How can I convert a ConcurrentDictionary to a Dictionary? -


i have concurrentdictionary object set dictionary object.

casting between them not allowed. how do it?

the concurrentdictionary<k,v> class implements idictionary<k,v> interface, should enough requirements. if need concrete dictionary<k,v>...

var newdictionary = yourconcurrentdictionary.todictionary(kvp => kvp.key,                                                           kvp => kvp.value,                                                           yourconcurrentdictionary.comparer);  // or... // substitute actual key , value types in place of tkey , tvalue var newdictionary = new dictionary<tkey, tvalue>(yourconcurrentdictionary, yourconcurrentdictionary.comparer); 

Comments

Popular posts from this blog

asp.net - repeatedly call AddImageUrl(url) to assemble pdf document -

java - Android recognize cell phone with keyboard or not? -

iphone - How would you achieve a LED Scrolling effect? -