[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework.sdk

iterating through parameters

Mark Belfer

10/30/2002 2:27:00 AM

Hi,

Does anyone know how to iterate through parameters and get
the values for them with in the method call.

I want to do something like that:

void test(string param1, int param2, ....)
{
for(int i=0; i < Params.Length; i++)
{
string paramName = Params[i].Name;
Object paramValue = Params[i].Value;
}
}


Thanks
Mark

1 Answer

zhaoyao

10/30/2002 1:33:00 PM

0

Hi Mark,

You could do something like....

moses.

--------------------------------------------------------------

public void test(params object[] list)
{
for ( int i = 0 ; i < list.Length ; i++ )
Console.WriteLine((object)list[i]);
}


"Mark Belfer" <mark@belfer.net> wrote in message
news:272901c27fb3$8ce92b80$95e62ecf@tkmsftngxs02...
> Hi,
>
> Does anyone know how to iterate through parameters and get
> the values for them with in the method call.
>
> I want to do something like that:
>
> void test(string param1, int param2, ....)
> {
> for(int i=0; i < Params.Length; i++)
> {
> string paramName = Params[i].Name;
> Object paramValue = Params[i].Value;
> }
> }
>
>
> Thanks
> Mark
>