I suppose there could be historical reasons for this naming and that other languages have similar feature, but it also seems to me that parameters always had a name in C#. Arguments are the unnamed ones. Or is there a particular reason why this terminology was chosen?

- 29,755
- 14
- 88
- 113

- 4,169
- 26
- 27
-
Related: http://stackoverflow.com/questions/156767/whats-the-difference-between-an-argument-and-a-parameter – Mechanical snail Aug 21 '12 at 01:24
4 Answers
Oh, you wanted arguments! Sorry, this is parameters - arguments are two doors down the hall on the left.

- 13,556
- 3
- 45
- 57
-
4
-
Just for the record this is yet another quote. I have nothing against @Sherm, in fact I quite like his response! – Chris Pfohl Dec 14 '10 at 14:01
Yes, you're absolutely right (to my mind, anyway). Ironically, although I'm usually picky about these terms, I still use "parameter passing" when I should probably talk about "argument passing". I suppose one could argue that prior to C# 4.0, if you're calling a method you don't care about the parameter names, whereas the names become part of the significant metadata when you can specify them on the arguments as well.
I agree that it makes a difference, and that terminology is important.
"Optional parameters" is definitely okay though - that's adding metadata to the parameter when you couldn't do so before :) (Having said that, it's not going to be optional in terms of the generated IL...)
Would you like me to ask the team for their feedback?

- 1,421,763
- 867
- 9,128
- 9,194
-
1Jon, you are fast and omnipresent :) I think that I read some of your blog or answers where you pointed the difference between the two. And I agree that correct terminology is important. As for team feedback I propose that you decide if this is thus important. Regards, Petar – pero Nov 20 '08 at 17:34
-
I think I'll leave this one then - mostly because even if the team changes documentation etc, it's *going* to be referred to as "named parameters" by the world anyway. How many people call "automatic properties" by their real name of "automatically implemented properties"? – Jon Skeet Nov 20 '08 at 21:07
I don't think so. The names are quite definitely the names of parameters, as they are defined and given a specific meaning in the method definition, where they are properly called the parameters to the method. At the call site, arguments can now be tagged with the name of the parameter that they supply a value for.
The new term refers to the perspective of the method caller - which is logical because that's where the feature applies. Previously, callers only had to think of parameters as being "positioned parameters". Now they can optionally treat them as "named parameters" - hence the name.

- 114,894
- 38
- 205
- 284
-
And yet Sam Ng, a developer at C# team (http://blogs.msdn.com/samng/archive/2007/11/06/yet-another-compiler-dev.aspx) refers to "named arguments" (http://blogs.msdn.com/samng/archive/2009/02/03/named-arguments-optional-arguments-and-default-values.aspx) – pero Feb 10 '09 at 22:30
-
If you look at http://code.msdn.microsoft.com/csharpfuture/Release/ProjectReleases.aspx?ReleaseId=1686 and open up a document titled "New Features in C# 4.0" you will find a chapter titled "Named and Optional Arguments" – pero Feb 10 '09 at 22:33
-
2All Microsoft employees could get the words "Named Arguments" tattooed on their foreheads if they want to, but it won't make any difference to the soundness of my reasoning! – Daniel Earwicker May 09 '09 at 22:10
I dont know if its worth adding it now, but MS calls it named arguments anyway. See named and optional arguments

- 70,104
- 56
- 326
- 368