It is very easy to use variable number of parameters in C# with the help of params keyword.
Here is a small example which will find the largest integer in from a list of integers where the size of the list is unknown.
public int FindLargest(int Num, params int[] Nums)
{
int Large = Num;
foreach (int n in Nums)
{
if (n > Large)
{
Large = n;
}
}
return Large;
}
This is nice :)
ReplyDeleteVery nice n wel arrangd.. I likd the design very much..
ReplyDelete