After looking at your code, my intuition suggests that what you want is for each stock to be a collection of "trades," where each trade has identifying information, and other data, and I think your question specifically asks how, at some point, to merge those collections in a way that maintains the "independence" of the stocks.
I'd start off by creating a Class that models a trade, rather than using the older 'ArrayList data structure which is just a "bucket" into which you can throw objects of any type:
public class Trade
{
public string name;
public int id;
public DateTime dt;
public int i1;
public int i2;
public Trade()
{
}
}
I'd then prototype the collections of trades that each stock will have:
List<Trade> Goog = new List<Trade>();
List<Trade> Aapl = new List<Trade>();
Let's create a few test instances of 'Trade:
Goog.Add (new Trade { name = "Google", id = 100, dt =DateTime.Now, i1 = 1, i2 = 2 });
Goog.Add (new Trade { name = "Google", id = 101, dt = DateTime.Now, i1 = 99, i2 = 100 });
Aapl.Add (new Trade { name = "Apple", id = 102, dt = DateTime.Now, i1 = 3, i2 = 4 });
Now let's consider the need to, at some point, merge different stocks. Since the "atomic" elements are Lists of type 'Trade, then this seems natural:
List<List<Trade>> AllTrades;
At the moment we wish to merge we could do something like:
AllTrades = new List<List<Trade>> { Goog, Aapl };
Or, of course, you could pre-initialize 'AllTrades, and just use 'Add, and 'Remove, as necessary.