How to initialize an optional paramerer for a structure type in C# ?
Is it possible in .NET 4.5?
string Foo(string myArg, KeyValuePair<string, string> myOptionalArg = ???)
{
// todo
}
Yes, you can initialize the optional argument to any compile time literal value that is of the appropriate type. For KeyValuePair the only compile time literal that is of that type (at least in any version of C# that currently exists) will be default(KeyValuePair<string, string>).