Key value pairs in C# Params
I'm looking for a way to have a function such as: myFunction({"Key", value}, {"Key2", value}); I'm sure there's something with anonymous types that would be pretty easy, but I'm not seeing it. The only solution I can think of is to have a params KeyValuePair<String, object>[] pairs parameter, but that ends up being something similar to: myFunction(new KeyValuePair<String, object>("Key", value), new KeyValuePair<String, object>("Key2", value)); Which is, admittedly, much uglier. EDIT: To clarify, I'm writing a Message class to pass between 2 different systems. It contains a ushort specifying