How to test if an object is disposed and GC'ed?

I'm writing some code to delete an object and wanted to have a unit test to ensure that the object is always deleted. What is the best way to do this? If GC is to work you should not be holding any references so how can you test without a reference?


There is no way to test if object is disposed in general case.

WeakReference is probably the thing you are looking for. You can create a WeakReference as part of the test and after your code has run this:

WeakReference wr = new WeakReference(obj);

Need Your Help

Difficulty loading MySQL data from select box using jQuery ajax.

php ajax jquery drop-down-menu javascript

I am trying to load mysql data from my database from a html select box. Here is the jquery function I am currently using, but it doesn't seem to update my results based on the selection. $(funct...

eclipse c/c++ CDT build just one file

c++ eclipse eclipse-cdt

I'm doing a C++ project with eclipse CDT but It takes a lot of time building all the source files.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.