Hello, I long for those sweet optional arguments from the days when I programmed in C++ more. I know they don't exist in C#, but my question is Why.
I think method overloading is a poor substitute which makes things messy very quickly.
void foo(int x,int y,int z=0){
//do stuff...
}
//is so much more clean than
void foo(int x,int y){
foo(x,y,0);
}
void foo(int x,int y,int z){
//do stuff
}
I just do not understand what the reasoning is. The C# compiler would obviously not have a problem supporting this just Microsoft elected not to support it.
Why, when C# was designed, did they not want to support optional arguments?