Link to home
Start Free TrialLog in
Avatar of rgn2121
rgn2121Flag for United States of America

asked on

How do I show detailed info in my interfaces? Trying to mimic IDisposable look.

I am creating an interface for use in my application and I was curious how to make my interface show some of the detail that IDisposable(shown below) does.  When you type implements IDisposable, all the code in the code window gets added.

I would like to add a region such as:

#Region "MyInterface support"
#End Region

or even show comments like the IDisposable does.  I have tried just adding them in the interface, but there must be something else I need to do.  I am curious if anyone knows how to do this?
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 managed resources when explicitly called
            End If
 
            ' TODO: free shared unmanaged resources
        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

Open in new window

Avatar of rgn2121
rgn2121
Flag of United States of America image

ASKER

Maybe I can make this easier...
What if, like IDisposable, I want my interface to add some code as well as the method signature?
ASKER CERTIFIED SOLUTION
Avatar of Alexandre Simões
Alexandre Simões
Flag of Switzerland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of rgn2121

ASKER

Thanks, just wanted to know if it was possible in the sense of anyone using my classes.  I understand and have created snippets, but thank you for the link.