views:

141

answers:

1

I want to pass a delegate with the return type as ArrayList as parameter of thread and want to store the values in an ArrayList as well. Any help in this regard will be appreciated.

A: 

Instead of having a return value you could try passing in another parameter by reference:

private class ThreadArguments
{    
    public ArrayList List1 { get; set; }
    public ArrayList List2 { get; set; }

    public ThreadArguments(ArrayList list1, ref ArrayList list2)
    {
        this.List1 = list1;
        this.List2 = list2;
    }
}

Thread myThread = new Thread(new ParameterizedThreadStart(...));
myThread.Start(args);

So the return value is effectively replaced by list2.

openshac
Thanks i solved my prob with different approach instead of returning value through thread.
Muhammad Waqas