can't you just change this
For Each item In mCollection
If IsObject(item) And Not compareByDefaultProperty Then
If item Is itemToSearchFor Then
Contains = True
Exit Function
End If
Else
If item = itemToSearchFor Then
Contains = True
Exit Function
End If
End If
Next item
to this
For Each item In mCollection
If item = itemToSearchFor Then
Contains = True
Exit Function
Else If item Is itemToSearchFor And Not CompareByDefaultProperty Then
Contains = True
Exit Function
End If
Next item
you would get rid of one level of nesting.
I think that if you did it this way you could even get rid of the CompareByDefaultProperty flag from this function.
am I missing something?