3 ms·
So you need to be mindful and have intelligent overloads for the DoSomething method? Personally, I don't really see that as much of a problem. Having run into
by sukuriant 13y ago
So you need to be mindful and have intelligent overloads for the DoSomething method?
Personally, I don't really see that as much of a problem. Having run into that issue before, I think the compiler catches it as as an error because its an ambiguous method signature. Instead, you have to pass something like: "DoSomething("foo", (string)null)" which, in that case, defeats the purpose of the optional parameter altogether.
- sitharus 13y agoYeah, been through that before. We just standardised on using overloads for external APIs, it's cleaner externally. The real issue is if you have DoSomething(string what, autoRetry=true) and you change to DoSomething(string what, autoRetry=false) - DLLs compiled against the old version will call with true even if the authors wanted the default behaviour.
- sukuriant 13y agoThat makes sense. As I said in my other thread, I locally deal with that problem by passing null instead of a primitive (though admittedly, I would probably use a primitive in cases of bool). That said, in this circumstance my method sounds more like a hack and yours the cleaner, correct route.