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 Is itemToSearchFor And Not CompareByDefaultProperty Then
Contains = True
Exit Function
Else If item = itemToSearchFor Then
Contains = True
Exit Function
End If
Next item
you would get rid of one level of nesting.
I am not really sure what the CompareByDefaultProperty flag is doing here, I would think that if there was a Default property to compare that you would exit the function right there if that is true and use a different function to compare the default properties.
am I missing something?