public class Worker { Game parent; public Worker(Game game) { parent = game; } } public class Game { public void CreateRandomGameEnvironment() { for (int i=0; i<500; ++i) { Worker temp = new Worker(this); temp.Randomize(i); Workers.Add(temp); } } }So, your Collection class code might look like this:
public class Columns : CollectionBase { Object ParentUserControl; // ---------------- A new field needed to reference the parent (Need to change Object to you UserContol class here and in the constructor below public Columns(Object ParentUserControl) // ---------------- Add a constructor for your class that will receive a Parent reference { this.parent = ParentUserControl; } public Column this[int index] { get {return (Column)List[index];} } public void Add(Column item) { List.Add(item); this.ParentUserControl.DoSomething(); // -------------- Now you can reach the Parent to do things } public void Insert(int index, Column item) { List.Insert(index, item); } public void Remove(Column item) { List.Remove(item); } }Also, when your UserControl creates an instance of this Collection, it will need to pass itself in:
Columns ColumnCollection = new Columns(this);