开发者

VB.net: Custom ' TODO: List on an Interface

开发者 https://www.devze.com 2022-12-31 10:49 出处:网络
How do I add my own todo and comments list to appear on Interfaces? I want it to pop up like IDisposable does:

How do I add my own todo and comments list to appear on Interfaces? I want it to pop up like IDisposable does:

Public Class Foo : Implements IDisposable

    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 Boolea开发者_如何学Gon) above.
        Dispose(True)
        GC.SuppressFinalize(Me)
    End Sub
#End Region

End Class

Whenever I enter my own comments and todo list they are never autogenerated like IDisposable Interface does. I would like my own Interfaces to preserve the comments so that I can share my Interfaces with in source documentation.


This code is hard-baked into Common7\IDE\msvb7.dll. Pretty shocking, considering how totally inappropriate it is for the 99.99% of cases where you'd want to implement IDisposable.

Consider using code snippets. You can create your own snippets with the Snippet Editor.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号