This is an anti-pattern.
Public Overrides Function Equals(ByVal obj As Object) As Boolean
If obj IsNot Nothing Then
If obj.GetType Is Me.GetType Then
Return Me._description.Equals(CType(obj, EventItem)._description)
Else
Return False
End If
Else
Return False
End If
End Function```
this is better and gives the same result same
```vbnet
Public Overrides Function Equals(ByVal obj As Object) As Boolean
Dim ReturnValue As Boolean = False
If obj IsNot Nothing AndAlso obj.GetType Is Me.GetType Then
Return Me._description.Equals(CType(obj, EventItem)._description)
End If
Return returnValue
End Function```
The anti-pattern is called the arrow anti-pattern and you can find plenty of things about it on the net and how to avoid it.
Here are some good ones.
[
Flattening Arrow Code][1] by Jeff Atwood
[Anti-Patterns and Worst Practices – The Arrowhead Anti-Pattern][2] by Chris Missal
Of course the design anti-pattern in the above code doesn’t only have that as a disadvantage. The biggest disadvantage is that ncover will never give you 100% code coverage 😉 because the end-ifs will never be reached.
<div class="image_block">
<img src="https://lessthandot.z19.web.core.windows.net/wp-content/uploads/blogs/DesktopDev/ncover/ncover3.png" alt="" title="" width="479" height="156" />
</div>
That in itself is a good reason not to write it. Because you are writting code that will never be used 😉
Disclaimer: Of course it will never compile if you leave out the end if.
[1]: http://www.codinghorror.com/blog/archives/000486.html
[2]: http://www.lostechies.com/blogs/chrismissal/archive/2009/05/27/anti-patterns-and-worst-practices-the-arrowhead-anti-pattern.aspx#