Reputation: 15219
I have a
Dictionary<int, bool> articlesInfo = new Dictionary<int, bool>();
I need a the int and bool to be converted to string, into a
Dictionary<string, string>
How is it possible via something like
Dictionary<string, string> newDictionary =
articlesInfo.Select(x => x.ToString(), y => y.ToString());
Upvotes: 1
Views: 556
Reputation: 42225
It's easiest to use Linq's ToDictionary
:
var newDictionary =
articlesInfo.ToDictionary(x => x.Key.ToString(), x => x.Value.ToString());
Upvotes: 7