Array question

  • Thread starter Thread starter y
  • Start date Start date
Y

y

Hi,

I am trying to return an array from a method and assign
then returned array to the calling method.

I am not sure why this error is coming up.

string [] arr_Selected = new string[100];

arr_Selected = AddToArray (arr_Selected, strSelectedID);

Thanks,
y
 
y said:
I am not sure why this error is coming up.

What error?
string [] arr_Selected = new string[100];

arr_Selected = AddToArray (arr_Selected, strSelectedID);

Reduce the second line of code to this:

AddToArray(arr_Selected, strSelectedID);

Since you're passing a reference to the array, there's no need to return
it or reassign it.
 
Back
Top