Difference between method parameters and method arguments
1. Difference between Method Parameters and Method Arguments
S.No Method Parameters Method Arguments
1 Method parameters get their Method arguments are itself having a
actual values from the arguments value.
that are specified when the i.e.,"arguments" refer to values bound
method is invoked. to those names.
i.e.,"parameters" refer to names
Example:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Sample
{
class Program
{
public static void Main()
{
int N1 = 10;
int N2 = 20;
//N1 and N2 are method arguments
int Total = Sum(N1, N2);
Console.WriteLine(Total);
}
//FNum and SNum are method parameters
public static int Sum(int FNum, int SNum)
{
int Sum = FNum + SNum;
return Sum;
}
}
}
Note: The arguments must be compatible with the parameter type but the argument name used in
the calling code does not have to be the same as the parameter named defined in the method which
is clear in the above example
Where,
FNum and SNum are method parameters, and
N1 and N2 are method arguments.
And, further updates on difference between questions and answers, please visit my blog @
http://onlydifferencefaqs.blogspot.in/