from this dictionary
var foo = new Dictionary<string, IEnumerable<object>>
{
{"key1", new object[] {1}},
{"key2", new[] {"one", "two"}},
{"key3", new[] {"three", "four"}}
}
i'd like to get this IEnumerable<dictionary<string, object>>
IEnumerable<Dictionary<string, object>> bar = {
{{"key1", 1}, {"key2", "one"}, {"key3", "three"}},
{{"key1", 1}, {"key2", "one"}, {"key3", "four"}},
{{"key1", 1}, {"key2", "two"}, {"key3", "three"}},
{{"key1", 1}, {"key2", "two"}, {"key3", "four"}}
}
To speak simply, I need C#'s analog of python itertools.product function Cartesian product of a dictionary of lists.
I've read Generating all Possible Combinations but couldn't figure out how i should change it and i couldn't found solution about cartesian product with dictionaries (with keys) result.
Thanks in advance