Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class MyBase {
- public List<SomeObject> list;
- public MyBase(){
- list = new List<SomeObject>();
- list.Add(new SomeObject());
- list.Add(new SomeObject());
- list.Add(new SomeObject());
- }
- ~MyBase() {
- foreach (SomeObject obj in list) {
- obj.Cleanup();
- }
- list.Clear();
- }
- }
- public class MyDerived : MyBase {
- public MyDerived() {
- foreach (SomeObject obj in list) {
- obj.SomeProperty = new Handler();
- }
- }
- ~MyDerived(){
- foreach (SomeObject obj in list) {
- obj.SomeProperty.Cleanup();
- }
- }
- }
Add Comment
Please, Sign In to add comment