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


Go to topic 50154

Return to index page 297
Return to index page 296
Return to index page 295
Return to index page 294
Return to index page 293
Return to index page 292
Return to index page 291
Return to index page 290
Return to index page 289
Return to index page 288