Named Argument

noun

say it: “NAYMD AR-gyoo-ment” /neɪmd ˈɑːrɡjumənt/

Passing a value to a method together with its parameter's name, to make the call clearer.

What is Named Argument in C#?

Named Argument — An argument supplied with its parameter name for clarity or reordered calls.

class Ticket
{
    void Reserve()
    {
        Book(seat: 12, row: "A");
    }

    void Book(string row, int seat)
    {
    }
}

In a sentence

  • “I wrote Ship(order, express: true) with a named argument, so it's clear what true means.”

Level: Apprentice · More C# terms at this level

Updated