Search code examples
c#parametersargumentsmethod-callmethod-signature

Following a course - I just saw a strange parameter usage in a function


I'm watching a C# course and I've just seen a strange usage of bool inside a parameter.

I'll show a screenshot of it:

enter image description here

What does that mean? I've never seen anything like this before.


Solution

  • It is a named parameter or argument introduced in C# 4 / Framework 4.0 / Visual Studio 2010:

    Named arguments free you from the need to remember or to look up the order of parameters in the parameter lists of called methods. The parameter for each argument can be specified by parameter name. For example, a function that prints order details (such as, seller name, order number & product name) can be called in the standard way by sending arguments by position, in the order defined by the function.

    Named and Optional Arguments (C# Programming Guide)