Click here to Skip to main content
15,889,651 members
Home / Discussions / .NET (Core and Framework)
   

.NET (Core and Framework)

 
QuestionHow does IDisposable Interface Generate Dispose sub? Pin
Polymorpher10-Dec-09 5:43
Polymorpher10-Dec-09 5:43 
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 " IDisposable Support "
            ' This code added by Visual Basic to correctly implement the disposable pattern.
            Public Sub Dispose() Implements IDisposable.Dispose
                  ' Do not change this code.   Put cleanup code in Dispose(ByVal disposing As Boolean) above.
                  Dispose(True)
                  GC.SuppressFinalize(Me)
            End Sub
#End Region

--
"Keyboard not found. Press < F1 > to RESUME. "
Source unknown (appears in many common BIOSes as a real error message)

AnswerRe: How does IDisposable Interface Generate Dispose sub? Pin
Paulo Zemek10-Dec-09 6:42
mvaPaulo Zemek10-Dec-09 6:42 
GeneralRe: How does IDisposable Interface Generate Dispose sub? Pin
Polymorpher10-Dec-09 12:55
Polymorpher10-Dec-09 12:55 
GeneralRe: How does IDisposable Interface Generate Dispose sub? Pin
Mark Salsbery10-Dec-09 13:00
Mark Salsbery10-Dec-09 13:00 
GeneralRe: How does IDisposable Interface Generate Dispose sub? Pin
Paulo Zemek10-Dec-09 13:26
mvaPaulo Zemek10-Dec-09 13:26 
GeneralRe: How does IDisposable Interface Generate Dispose sub? Pin
Polymorpher10-Dec-09 14:41
Polymorpher10-Dec-09 14:41 
GeneralRe: How does IDisposable Interface Generate Dispose sub? Pin
The Man from U.N.C.L.E.14-Dec-09 0:12
The Man from U.N.C.L.E.14-Dec-09 0:12 
GeneralRe: How does IDisposable Interface Generate Dispose sub? Pin
Polymorpher14-Dec-09 2:06
Polymorpher14-Dec-09 2:06 
QuestionNeed help with the event based async pattern Pin
Jeroen De Dauw10-Dec-09 4:55
Jeroen De Dauw10-Dec-09 4:55 
AnswerRe: Need help with the event based async pattern Pin
Ashfield11-Dec-09 1:21
Ashfield11-Dec-09 1:21 
GeneralRe: Need help with the event based async pattern Pin
Jeroen De Dauw11-Dec-09 3:25
Jeroen De Dauw11-Dec-09 3:25 
GeneralRe: Need help with the event based async pattern Pin
Ashfield11-Dec-09 9:29
Ashfield11-Dec-09 9:29 
QuestionExport to excel [modified] Pin
Uma J10-Dec-09 0:16
Uma J10-Dec-09 0:16 
AnswerRe: Export to excel Pin
dan!sh 10-Dec-09 1:18
professional dan!sh 10-Dec-09 1:18 
AnswerRe: Export to excel Pin
Ashfield10-Dec-09 1:24
Ashfield10-Dec-09 1:24 
AnswerRe: Export to excel Pin
Dave Kreskowiak10-Dec-09 4:26
mveDave Kreskowiak10-Dec-09 4:26 
AnswerRe: Export to excel Pin
The Man from U.N.C.L.E.11-Dec-09 22:57
The Man from U.N.C.L.E.11-Dec-09 22:57 
QuestionPOP3 Class Pin
joelle@scope9-Dec-09 2:17
joelle@scope9-Dec-09 2:17 
AnswerRe: POP3 Class Pin
Richard MacCutchan9-Dec-09 3:26
mveRichard MacCutchan9-Dec-09 3:26 
QuestionType inference problem [modified/solved] Pin
Gideon Engelberth8-Dec-09 13:50
Gideon Engelberth8-Dec-09 13:50 
Questionhow to use .net framework with c++; Pin
geniuspc8-Dec-09 12:04
geniuspc8-Dec-09 12:04 
AnswerRe: how to use .net framework with c++; Pin
DaveyM698-Dec-09 12:34
professionalDaveyM698-Dec-09 12:34 
AnswerRe: how to use .net framework with c++; Pin
Paul Conrad8-Dec-09 13:28
professionalPaul Conrad8-Dec-09 13:28 
AnswerRe: how to use .net framework with c++; Pin
The Man from U.N.C.L.E.9-Dec-09 7:10
The Man from U.N.C.L.E.9-Dec-09 7:10 
Questionhow to insert image Pin
darkyro8-Dec-09 4:03
darkyro8-Dec-09 4:03 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.