I have a class that should delete some file when disposed or finalized. Inside finalizers I can\'t use other objects because they could have been garbage-collected already.<
You can call the dispose method inside your finalizer and have the file cleanup code in the Dispose method. Along with that you can also pass a boolean to your dispose method that indicates that you are invoking it from the finalizer.
For an excellent reference on the proper usage of Dispose and Fianlizers , read this Proper use of the IDisposable interface