Alex Rivera | Logout

How can I convert a ConcurrentDictionary to a Dictionary?

Asked 2010-12-02T00:58:21.160
38

I have a ConcurrentDictionary object that I would like to set to a Dictionary object.

Casting between them is not allowed. So how do I do it?

Edit
Report

1 Answer

2
ConcurrentDictionary<int, string> cd = new ConcurrentDictionary<int, string>();
Dictionary<int,string> d = cd.ToDictionary(pair => pair.Key, pair => pair.Value);
answered 2010-12-02T01:08:54.007

Your Answer