void establishAddress(out string [] address_line)
{
// do something
}
string[] address_to_print = new string[50];
address_to_print = establishAddress(out address_line);
Apart from the fact that I could pass out an array,
what is wrong with the above code?
Usually, the proper response to people not undestanding the essence of
your question is to restate it, but anyway...
Besides the fact that you didn't assign the "out" parameter in the
establishAddress method (an error that the compiler will catch) there
is another error, which is that you're trying to assign the result
from a void method (which doesn't return any result) to a variable
that you've already pointed to an array of 50 strings. The compiler
would catch that error, too.
Assuming that you meant to say:
string[] address_line = new string[5];
establishAddress(out address_line);
then the error _there_ would be that you instantiated an array of 50
strings and put its reference in address_line, only to have that
reference clobbered by another reference returned by establishAddress
via its out parameter. The compiler _wouldn't_ catch that, by the way.