Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Studio
  4. How does IDisposable Interface Generate Dispose sub?

How does IDisposable Interface Generate Dispose sub?

Scheduled Pinned Locked Moved Visual Studio
questioncsharptutorial
1 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    Polymorpher
    wrote on last edited by
    #1

    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

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups