Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class A
- {
- ~A()
- {
- Console.WriteLine("Destruye instancia de A");
- }
- }
- class B
- {
- object Ref;
- public B(object o)
- {
- Ref = o;
- }
- ~B()
- {
- Console.WriteLine("Destruye instancia de B");
- }
- }
- class PruebaColeccionadorBasura
- {
- static void Main()
- {
- B b = new B(new A());
- b = null;
- GC.Collect();
- GC.WaitForPendingFinalizers();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement