Wrox Programmer Forums
Go Back   Wrox Programmer Forums > C# and C > C# 1.0 > C#
|
C# Programming questions specific to the Microsoft C# language. See also the forum Beginning Visual C# to discuss that specific Wrox book and code.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C# section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old December 7th, 2006, 09:25 AM
Friend of Wrox
 
Join Date: Aug 2006
Posts: 231
Thanks: 0
Thanked 1 Time in 1 Post
Default multiple arguments

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......
__________________
thanks......
 
Old December 8th, 2006, 04:45 AM
Friend of Wrox
 
Join Date: May 2006
Posts: 106
Thanks: 0
Thanked 0 Times in 0 Posts
Default

by params you can pass vaiable no. of parameter of same type

Bijgupt
 
Old December 8th, 2006, 07:34 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,093
Thanks: 1
Thanked 12 Times in 11 Posts
Default

 
Quote:
quote:by params you can pass vaiable no. of parameter of same type


...or variable number of parameters of any type.

Code:
static void Main()
        {
            PassArbitraryNumberOfDifferentTypes(new Object(), "Bob", 100);
        }

        static void PassArbitraryNumberOfDifferentTypes(params Object[] objects)
        {
            foreach (Object o in objects )
            {
                //...........
            }
        }
HTH,

Bob






Similar Threads
Thread Thread Starter Forum Replies Last Post
Doesn't work properly for multiple file arguments. sbubendorf VBScript 7 September 20th, 2007 08:52 AM
Passing multiple arguments to function zarikiane XSLT 2 July 18th, 2006 09:35 AM
Problem passing multiple arguments to php script method PHP How-To 0 February 8th, 2006 09:03 AM
Getting the data out with multiple arguments toni_montana PHP Databases 2 September 12th, 2004 06:57 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.