public void Start() { foreach (T o in GetArray()) { if (null == o) { continue; } if (o is Energy.Interface.IWorker) { Energy.Interface.IWorker w = o as Energy.Interface.IWorker; w.Start(); } } }
public void Spawn() { try { T o = Activator.CreateInstance <T>(); _List.Add(o); if (o is Energy.Interface.IWorker) { Energy.Interface.IWorker worker = o as Energy.Interface.IWorker; worker.Start(); } } catch (MissingMethodException) { System.Diagnostics.Debug.WriteLine("Missing method for constructing new object for spawn"); } }