Click here to Skip to main content
16,022,362 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
Hi,
Here is my code:
C#
class A
{
  Class B
  {
  }
}

Class C
{
  //stores the references of Class B
}

I am collecting the objects of A in a Dictionary. When I delete one of the object of A from dictionary then the corresponding B's object should also get deleted. But B's reference is not getting deleted.

Will you please tell how to accomplish this?
Posted
Updated 15-Aug-10 20:48pm
v2

1 solution

Make class A disposable by adding the "IDisposable" interface to the inheritance list, and manually kill the reference in the Dispose method.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900