JoeRip wrote:
call Dispose() from my destructor
Please make sure you are getting the terminology correct. In C#, the "destructor" is the Dispose() method. If you mean you are calling Dispose() from a method like ~Class(), then you are calling it from a finalizer. If that's the case, you need to triple-check the decision to use a finalizer and make sure that you have everything written correctly as they add a performance penalty to your object and are not trivial to write properly.
JoeRip wrote:
Does this mean I also need to test this.disposed in the get/set clauses of my properties?
A lot of this really depends on why you are implementing IDisposable. If you are maintaining some unmanaged resources or other objects that implement IDisposable then you would want to do this test in your public methods and properties. You can simplify this by creating a single helper method that throws an ObjectDisposedException and then just call that as the first line in any of your methods or properties. If you are using IDisposable simply to get the "using semantics", then you don't need to bother. You can check this article[^] for more information on how to write finalizers and the dispose pattern as well.
Scott Dorman
Microsoft® MVP - Visual C# | MCPD President - Tampa Bay IASA [Blog][Articles][Forum Guidelines]
Hey, hey, hey. Don't be mean. We don't have to be mean because, remember, no matter where you go, there you are. - Buckaroo Banzai