I'm looking at implementing IDisposable
for a transaction-like class I am creating. All of the MSDN documentation I have read mentions that IDisposable
should be used for freeing unmanaged resources, not necessarily talking about the convenience and tidiness of not having a try-catch-finally around everything.
All of what I want to do deals with managed resources, but I do want the Dispose()
method to effectively perform a rollback if nothing was committed before it was called - is there anything wrong with using it for this purpose?