Monday, March 12, 2012

What is the difference between a Parameter and an Argument in C#?

Well, I believe most people use these terms interchangeably. But what is the *formal* distinction between these two terms in C#?

Thanks for the help.

BCBThe *formal* difference is that an argument is a supplied value to a function or method. A parameter is a place holder for this value. This definition was depricated as of the C99 standard. as su i.e.

public class SomethingDoer
{
public SomethingDoer()
{
String argument = "This is an argument.";
DoSomething(argument);
}

public void DoSomething(String parameter)
{
//Do something here
}
}

Paul B
Paul - Thanks for clearing this up, but I have another question. If the definition was deprecated in the C99 standard, does that mean that post-C99 the terms parameter and argument are interchangeable?

Thanks.

BCB
From everyone and everywhere I've heard, yes. I may be young, 20, but I'm not a fan of colliding the terms. Fight for your right I guess. :)

0 comments:

Post a Comment