I want to add all the values from a dictionary of ints to a dictionary of strings as strings. What is the most efficient or effective way of doing this...is there a better way to write this code?
static void Main()
{
var dictOfStrings = new Dictionary<string, string>
{
{"sky", "blue"},
{"sun", "orange"},
{"stop sign", "red"},
{"iguana", "green"}
};
var dictOfNumbers = new Dictionary<int, int>
{
{5, 2},
{7, 1},
{9, 0},
{19, -1}
};
foreach (var number in dictOfNumbers)
{
dictOfStrings.Add(number.Key.ToString(), number.Value.ToString());
}
foreach (var item in dictOfStrings)
{
Console.WriteLine(item);
}
Console.ReadKey();
}