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.
If you don’t want the user to call the DoSomething method that takes no parameters, just make it private like so: