But some of the callers is the Dictionary's TryGetValue and ContainsKey and so require the result of the method to be a Dictionary, how can I convert the IEnumerable<KeyValuePair<string, ArrayList>>
into a Dictionary<string, ArrayList>
so that I can use TryGetValue ?
I've a method which at present returns an IEnumerable<KeyValuePair<string, ArrayList>>.
I want to make it more generic by making it return an IEnumerable<string, ArrayList>
.
method:
public IEnumerable<KeyValuePair<string, ArrayList>> GetComponents()
{
// ...
yield return new KeyValuePair<string, ArrayList>(t.Name, controlInformation);
}
caller:
Dictionary<string, ArrayList> actual = target.GetComponents();
actual.ContainsKey("something");