Hello Friends!
I want to know why we use Param keyword in .net. What are its uses and benefits. Please explain the use of Param keyword in following code sample.
class Program
{
static void Main(string[] args)
{
int y = Add(10,20,30,40,50);
Console.WriteLine("The Addition of Numbers are : " + y);
Console.ReadLine();
}
static int Add(params int[] listNumbers)
{
int Total = 0;
foreach (int i in listNumbers)
{
Total = i + Total;
}
return Total;
}
}
Thanks