Re: Arrays as parameters

samir parekh <[email protected]> Tue, 24 Jun 2008 07:17:56 -0700
Newsgroups gmane.comp.windows.devel.dotnet.winforms
Message-ID <[email protected]>
Why dont you use ArrayList , its a perfect solution when you dont know the size of array you will be passing or you might go further with a List<string> which is strongly typed string arraylist.

Since it is a list it is DMA and can grow as much as you like.

if they are named params I used to passon a stringdictionary or Dictionary<string,string> iwth default values prepopulated and the replace the values from the commandline to the default values, in this way your prog always has some data / param values to operate on.


Regards
sam

Regards
sam








--- On Tue, 6/17/08, Steve Abaffy <[email protected]> wrote:
From: Steve Abaffy <[email protected]>
Subject: [DOTNET-WINFORMS] Arrays as parameters
To: [email protected]
Date: Tuesday, June 17, 2008, 12:47 AM

Hello,

        How does one do the following:

Class Someclass{

        Private string [] myarray;

        Public string [] MyArray {get { return myarray[];} set{myarray[]=
value;}}
}
Correctly? I want to be able to declare this class in my main function and
set the parameters of the myarray as

Someclass Sc = new someclass;
Sc.MyArray[0] = "This is test 1";
Sc.MyArray[1] = "Thisis test 2";
Etc...

Thanks