I'm using a huge binary tree like structure whose nodes may or may not make use of unmanaged resources. Some of these resources may take up a lot of memory, but only a few of them will be in use at a time. The initial state of the tree can be seen as 'dormant'.
Whenever a node is accessed, that specific node and its children will 'wake up' and lazily acquire their assigned resources. Likewise, accesing a different branch in the tree will put the currently active branch to sleep causing its resources to be released. This means that any given node can be woken up and put to sleep once and again at any given time.
I'm currently taking advantage of the IDisposable interface to achieve this. It's being quite useful because there are a lot of cases where I need to create small branches that will be used locally, and the 'using' keyword comes really handy ensuring that no resource will be left open accidentally.
Am I ok implementing IDisposable on objects that don't really get disposed but sort of put to sleep?
Thanks in advance.
Edit: Thanks all for all the clever answers. I liked the idea of disposing of a resource's access instead of the resource itself. Now I'm in search of a better name for the function responsible for the clean up. (Any ideas other than Release() or Sleep()? Thanks again.