I am starting to take advantage of optional parameters in .Net 4.0
The problem I am having is when I try to declare an optional parameter of System.Drawing.Color:
public myObject(int foo, string bar, Color rgb = Color.Transparent)
{
// ....
}
I want Color.Transparent to be the default value for the rgb param. The problem is, I keep getting this compile error:
Default parameter value for 'rgb' must be a compile-time constant
It really kills my plan if I can only use primitive types for optional params.