.NET Framework에서 인터페이스를 구현할 때 Visual Studio에서 주석 (및 영역과 같은 다른 장점)을 생성하는 사례를 보았습니다.인터페이스에 주석 추가
좋은 예가 IDisposable
입니다. 구현하면 Visual Studio에서 다음 코드 블록을 생성합니다.
#Region "IDisposable Support"
Private disposedValue As Boolean ' To detect redundant calls
' IDisposable
Protected Overridable Sub Dispose(disposing As Boolean)
If Not Me.disposedValue Then
If disposing Then
' TODO: dispose managed state (managed objects).
End If
' TODO: free unmanaged resources (unmanaged objects) and override Finalize() below.
' TODO: set large fields to null.
End If
Me.disposedValue = True
End Sub
' TODO: override Finalize() only if Dispose(ByVal disposing As Boolean) above has code to free unmanaged resources.
'Protected Overrides Sub Finalize()
' ' Do not change this code. Put cleanup code in Dispose(ByVal disposing As Boolean) above.
' Dispose(False)
' MyBase.Finalize()
'End Sub
' 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(disposing As Boolean) above.
Dispose(True)
GC.SuppressFinalize(Me)
End Sub
#End Region
이 코드는 내 코드에서 할 수 있습니까? 그렇다면 어떻게? 인터페이스의 메소드에 메소드의 일반적인 목적이 무엇인지 구현 자에게 알려주는 몇 가지 설명을 추가하고 싶습니다.
가능한 복제본 [VB.net : Custom 'TODO : List on an Interface] (http://stackoverflow.com/questions/2884036/vb-net-custom-todo-list-on-an-interface) –