Parameters and Arguments

These days I’m reading “C# in Depth, Second Edition” written by a very famous C# MVP Jon Skeet. In his book Jon cleared the difference between Parameters and Arguments which I thought to share, with his permission. A lot of software developers really use these words interchangeably when discussing about programming with each other and sometimes we never realized that.
A parameter is the variable which is part of the method or indexer declaration whereas an argument is an expression used when calling the method or indexer. For example:
private void M1(int number)
// some code
//somewhere else in the code 
int value = 10;

In the code snippet above number is the parameter whereas as value is the argument. Hope you will now use these words properly, if you were interchanging them previously like me 🙂

  • Correct me if i am wrong :I don’t think that ‘VALUE'(the variable)is the argument.. the value the variable ‘VALUE’ holds is the argument …

  • @Anum: As per definition of argument the varibale ‘value’ is argument and also if I call M1 like :

    M1(100) or M1(a) //where int a=5;

    both 100 and ‘a’ are argument

  • Jon

    Section 7.4.1 suggests that the argument here would be “value” (the variable). The argument is *evaluated* to 10 at execution time.

  • Wow! Thanks Jon!

  • Thanks 🙂