Okay, so I'm upgrading a VB6 app to VB.NET and I'm unsure of how to modernize the class_terminate component of a container class I'm building:
Private Sub class_terminate()
If Not (colUserMappings Is Nothing) Then
Set colUserMappings = Nothing
End If
End Sub
The issue is that the .NET equivalent of this .Finalize
leaves open some potential runtime errors, because setting a container's final reference to nothing doesn't necessarily destroy the container, as .NET languages have non-deterministic finalization.
That being the case, how would I modernize the collections class in such a way that calling its terminate or finalize function would actually result in the destruction of the container at the end? Is there a good workaround for this?