|
Subject:
|
multiple arguments
|
|
Posted By:
|
MunishBhatia
|
Post Date:
|
12/7/2006 8:25:29 AM
|
hello i want to know what to be declared in function argument where the numbers of arguments pass to it at run time are unknown
Plz Tell
thanks......
|
|
Reply By:
|
bijgupt
|
Reply Date:
|
12/8/2006 3:45:11 AM
|
by params you can pass vaiable no. of parameter of same type
Bijgupt
|
|
Reply By:
|
Bob Bedell
|
Reply Date:
|
12/8/2006 6:34:54 AM
|
quote: by params you can pass vaiable no. of parameter of same type
...or variable number of parameters of any type.
static void Main()
{
PassArbitraryNumberOfDifferentTypes(new Object(), "Bob", 100);
}
static void PassArbitraryNumberOfDifferentTypes(params Object[] objects)
{
foreach (Object o in objects )
{
//...........
}
}
HTH,
Bob
|