I have a abstact class named Organism which has a Born event. Also I have some classes that inherit the Organism class... So my question is how can I raise the Born event among all instances of all classes, which inherited the Organism class?
EDIT: Sorry, The event I meant to write was Tick not Born... Born is a instance level event...
public class Organism : IDisposable
{
public static List<Organism> All = new List<Organism>();
private bool disposed = false;
public Organism()
{
Organism.All.Add(this);
}
public void BeBorn()
{
throw new NotImplementedException();
}
public void Dispose()
{
Dispose(true);
GC.SuppressFinalize(this);
}
private void Dispose(bool disposing)
{
if (!this.disposed)
{
if (disposing)
{
Organism.All.Remove(this);
}
disposed = true;
}
}
~Organism()
{
Dispose(false);
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With