I occasionally find myself passing this
or Me
to a child object. Such as this condensed real-world example...
Public Class Entity
Private mValidator as New EntityValidator()
Readonly Property IsValid()
Return mValidator.Validate(Me)
End Property
End Class
I'm concerned about .Validate(Me)
. I get no warnings or Code Analysis violations, but it just feels wrong. I get nervous about infinite recursion and garbage collection.
We have memory leaks on a project and I've wondered if it was due to this. I've never been able to find any resource that addresses the issue.
Is this practice OK, or is my paranoia deserved?