mp said:
Hi,
Is possible to return ArrayList or Array from Method and how?
Where I can find some example?
Just to add...
When you return an array or ArrayList instance from a method, you are
simply returning a *reference*.
Here's an example of using a /returned/ reference to an ArrayList instance:
class Test
{
static void Main()
{
ArrayList list = GetArrayList();
list.Add("number two");
// 'list' now contains two items
Console.WriteLine(list[0] as string);
Console.WriteLine(list[1] as string);
Console.Read();
}
static ArrayList GetArrayList()
{
ArrayList result = new ArrayList();
result.Add("number one");
return result;
}
}