Not giving an 'out' argument
c#
Solution
A good workaround is:
bool SomeOtherFunction(int arg1, out int argOut){ ... }
bool SomeOtherFunction(int arg1)
{
int dummyArgOut;
return SomeOtherFunction(arg1, dummyArgOut);
}
I'd even say its the best workaround.
Problem
It is possible to assign default values to normal arguments to a function, such that ``` bool SomeFunction(int arg1 = 3, int arg2 = 4) ``` can be called in any of the following ways. ``` bool val = SomeFunction(); bool val = SomeFunction(6); bool val = SomeFunction(6,8); ``` Is there a way of doing something similar (other than just creating an unused variable) such that ``` bool SomeOtherFunction(int arg1, out int argOut) ``` can be called in either of the following ways? ``` int outarg; bool val = SomeOtherFunction(4,outarg); bool val = SomeOtherFunction(4); ``` Is this at all possible, or if not, what are good workarounds? Thanks.