Is there a way to "tell" a method with optional parameters to use the default values, beyond omitting the parameter? I imagine the syntax would look something like this:
DoSomething(myParam: default) //calling the method
public void DoSomething(int myParam = 5) { ... } //method definition
The reason for doing this is to avoid ambiguity between an overload of this method that takes no parameters. In other words, I don't want this method to be called:
public void DoSomething() { ... }
Thanks in advance.
GetObjectById()GetObjectByName, ... etc, including a catch-allGetObject(); all of these call a privateGetObject(..)that uses optional parameters. This is because the caller of these functions doesn't support optional parameters.GetObject(..)is private, I'd suggest renaming it.