Home > Software engineering >  How to write in the custom interface such as predefined code.
How to write in the custom interface such as predefined code.

Time:10-11

In system reserved interface, often contains some predefined code, such as the following code:
 
Public Class XXXX
Implements IDisposable

System will automatically construct the following code:
 
# Region "IDisposable Support
"Private disposedValue As Boolean 'detect the redundant call

'IDisposable
Protected Overridable Sub Dispose (ByVal disposing As Boolean)
If Not Me. DisposedValue Then
If disposing Then
'TODO: release hosting state (managed object),
End the If

'TODO: release unmanaged resources (unmanaged objects) and write down the Finalize (),
'TODO: will be set to null large fields,
End the If
Me. DisposedValue=https://bbs.csdn.net/topics/True
End Sub

'TODO: only when the above the Dispose (ByVal disposing As Boolean) has to release unmanaged resources of code rewriting Finalize (),
'Protected Overrides Sub Finalize ()
"' do not change the code, please put clean code in the above the Dispose (ByVal disposing As Boolean),
'the Dispose (False)
'MyBase. Finalize ()
'End Sub

'Visual Basic add this code is to achieve the correct disposal mode,
Public Sub the Dispose () Implements IDisposable. Dispose
'don't change the code, please put clean code in the above the Dispose (ByVal disposing As Boolean),
Dispose (True)
GC. SuppressFinalize (Me)
End Sub
# End Region


How to achieve the above functions in custom interface?

CodePudding user response:

No one know? This is very helpful to improve the quality of programming should be,

CodePudding user response:

Is this vb.net?
  • Related