R
Russell Hind
I want to create an array of key value pairs. This code compiles fine:
KeyValuePair<string, object>[] kvps = {
new KeyValuePair<string,object>( "int", 5 ),
new KeyValuePair<string,object>( "string", "robot")
};
But is their no shorthand to this such as
KeyValuePair<string,object>[] kvps = {{"int",5 },{"string","a string"}};
This works:
object[,] kvps = {{"int",5},{"string","a string"}};
But I would like the array to be KeyValuePairs<> and the top syntax is
very long winded.
Cheers
Russell
KeyValuePair<string, object>[] kvps = {
new KeyValuePair<string,object>( "int", 5 ),
new KeyValuePair<string,object>( "string", "robot")
};
But is their no shorthand to this such as
KeyValuePair<string,object>[] kvps = {{"int",5 },{"string","a string"}};
This works:
object[,] kvps = {{"int",5},{"string","a string"}};
But I would like the array to be KeyValuePairs<> and the top syntax is
very long winded.
Cheers
Russell