G
Guest
1) How necessary is it to throw the ObjectDisposedException? I see that most
implementations I've come across in the web do not do this? Will I overkill
my class if I throw the ObjectDisposedException in all of my public methods?
Public Sub DoSomething()
If Me.disposed Then
Throw New ObjectDisposedException()
End if
End Sub
2) If I've already implement the dispose method, is it necessary to set the
object to nothing? Does setting it to nothing help the GC to clean it up
sooner?
Dim mycls as MyClass
' do something with mycls obj
mycls.dipose()
mycls = Nothing
Thanks!
implementations I've come across in the web do not do this? Will I overkill
my class if I throw the ObjectDisposedException in all of my public methods?
Public Sub DoSomething()
If Me.disposed Then
Throw New ObjectDisposedException()
End if
End Sub
2) If I've already implement the dispose method, is it necessary to set the
object to nothing? Does setting it to nothing help the GC to clean it up
sooner?
Dim mycls as MyClass
' do something with mycls obj
mycls.dipose()
mycls = Nothing
Thanks!