views:

205

answers:

1

Is there a way of checking if an object was collected by the Garbage Collector in .NET?

I'm trying to write an API that'll hook onto some events of objects that are passed in, and I need to make sure I don't use strong references to the object. I know how to do this, but I'd also like to write a unit test to verify this, and that I don't know how to do.

+2  A: 

Please see this answer by Paul Stovell.

Mitch Wheat
Gah!. Thanks, I couldn't find that answer in either the search or the other question suggestion when asking this question.
Cameron MacFarland
I know SO's search sucks somewhat.
Mitch Wheat