I have a method that takes a dictionary as a parameter like this:
void Do(Dictionary<string,string> d)
I would like to create a method that I would be able to call just like the dictionary collection initializer, like this:
Do({"sadfs","sdfsa"}, {"sadda","sada"}, ...);
anybody knows how to do this?
You can’t – you can use a collection initializer, but you do have to specify the type:
If the dictionary is going to be the same every time and you know that the method doesn’t mutate it, I’d extract it to a static readonly variable, which has the benefit that you can give it a meaningful name.