Saturday, November 4, 2017

named arguments in C# 7.2

...as opposed to positional arguments, these are variables handed in when calling a method that do not necessarily have to correspond sequentially to the variables at the method signature. You lead a variable with its name followed by a colon to make this happen, and beyond that you otherwise just specify variables as separated with commas as you would normally. Named arguments may even be mixed with positional arguments as suggested here. Something newish with C# 7.2 is that you may have a named argument followed by a positional argument followed by another named argument in lieu of having to have named arguments at the end of calling positional arguments. In that scenario, the second positional argument gets hydrated with the second value. optional and reloadOnChange as given here are examples of named arguments.

No comments:

Post a Comment