Suppose you have a method with the following signature:
public void SomeMethod(bool foo = false, bool bar = true) { /* ... */ }
When calling this method, is there a way to specify a value for bar
and not foo
? It would look something like...
SomeMethod(_, false);
... which would translate to...
SometMethod(false, false);
... at compile-time. Is this possible?
Take a look at named parameters.
SomeMethod(bar: false);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With