While victimization the perform member, any numbers of parameter (including none) might seem within the job perform supported want. thus to possess a versatile perform we are able to use params modifier whereas writing the definition of functions.
params keyword specify a way parameter that takes AN argument wherever the numbers of arguments become variable means that parameter arrays enable a variable numbers of arguments to be passed in to a perform. it's additionally sort compatible with the parameters. for instance we are able to send integers , characters, strings at a time to the perform that has the params modifier declared.
params keyword specify a way parameter that takes AN argument wherever the numbers of arguments become variable means that parameter arrays enable a variable numbers of arguments to be passed in to a perform. it's additionally sort compatible with the parameters. for instance we are able to send integers , characters, strings at a time to the perform that has the params modifier declared.
private void ParamsUsed()
{
ArrayList listForObject = new ArrayList();
ArrayList listForInt = new ArrayList();
{
ArrayList listForObject = new ArrayList();
ArrayList listForInt = new ArrayList();
int[] myarray = new int[] { 10, 11, 12 ,13, 14, 15, 16 };
listForObject = UseParams2(100, 200, 'A', "amit");
listForInt = UseParams(myarray);
listForObject = UseParams2(100, 200, 'A', "amit");
listForInt = UseParams(myarray);
DropDownList1.DataSource = listForObject;
DropDownList1.DataBind();
DropDownList1.DataBind();
DropDownList2.DataSource = listForInt;
DropDownList2.DataBind();
DropDownList2.DataBind();
}
public
static ArrayList UseParams2(params object[] list)
{
ArrayList listT = new ArrayList();
for (int i = 0; i < list.Length; i++)
{
listT.Add(list[i]);
}
return listT;
}
ArrayList listT = new ArrayList();
for (int i = 0; i < list.Length; i++)
{
listT.Add(list[i]);
}
return listT;
}
public static ArrayList UseParams(params int[] list)
{
ArrayList listT = new ArrayList();
for (int i = 0; i < list.Length; i++)
{
listT.Add(list[i]);
}
return listT;
}
{
ArrayList listT = new ArrayList();
for (int i = 0; i < list.Length; i++)
{
listT.Add(list[i]);
}
return listT;
}







0 comments:
Post a Comment