How does IDisposable Interface Generate Dispose sub?
-
I posted this in the .NET forum, but was told that this was probably a better place for an answer. The original question: *********************************************** Ok, I have never understood this. Its an interface and therefore has no code in it...only 'stubs'. So when you implement it, it generates the Dispose method...and the Dispose method has code in it...how does this work? Id like to have my interface do something like this. for example, create a class and implement IDisposable, press enter and it will generate the following VARIABLES and code blocks, not just empty subs. Private disposedValue As Boolean = False ' To detect redundant calls ' IDisposable Protected Overridable Sub Dispose(ByVal disposing As Boolean) If Not Me.disposedValue Then If disposing Then ' TODO: free other state (managed objects). End If ' TODO: free your own state (unmanaged objects). ' TODO: set large fields to null. End If Me.disposedValue = True End Sub #Region " IDis