41

Possible Duplicate:
What's the difference between an argument and a parameter?

What is the difference between an argument & a parameter in C#?

Are they the same thing?

Community
  • 1
  • 1
Goober
  • 13,146
  • 50
  • 126
  • 195
  • 30
    an argument ensues when two programmers cannot agree on the parameters. – Steven A. Lowe Nov 02 '09 at 21:11
  • 1
    There are at least two non-closed, language-agnostic versions of this question: http://stackoverflow.com/questions/3176310/difference-between-parameter-and-argument and http://stackoverflow.com/questions/427653/arguments-or-parameters. There's also another C# version of this question; I've requested a merge. – Pops Apr 19 '11 at 19:13
  • they are used interchangeably but anyway to be accurate check this [article](http://en.wikipedia.org/wiki/Parameter_(computer_science)) – Hannoun Yassir Nov 02 '09 at 21:11

3 Answers3

122

Well, neither keyword is present in the language, so the question is somewhat vague. The best that can be done is to look how each term is used in C# language specification (1.6.6.1 "Parameters"):

Parameters are used to pass values or variable references to methods. The parameters of a method get their actual values from the arguments that are specified when the method is invoked.

So, "parameters" refer to names, and "arguments" refer to values bound to those names. E.g.:

void Foo(int x, int y); // x and y are parameters
Foo(1, 2);  // 1 and 2 are arguments
Pavel Minaev
  • 99,783
  • 25
  • 219
  • 289
0

In the context of functions yes, they are the same, sometimes if you are talking about passing data to executables such as MyApp.exe /a:value /b:somethingelse, this might be refered to as arguments

bashmohandes
  • 2,356
  • 1
  • 16
  • 23
0

Typically, I refer to command-line arguments, as arguments. Arguments to a method or function I typically call parameters.

However, this isn't convention and both can be used interchangeably without people getting confused.

Ben S
  • 68,394
  • 30
  • 171
  • 212