I have an array of keys and values from which I want to create a dictionary:
var keys = new string[] { "Key1", "Key2" };
var values = new string[] { "Bob", "Tim" };
The imperative way would be this:
var dictionary = new Dictionary<string, string>();
for(int i = 0; i < keys.Length; i++) {
dictionary.Add(keys[i], values[i]);
}
How would I do this without loops? Probably with Linq? I've looked at Array.Join, but can't figure out how to make it work for me in this case.