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?
down a little bit you have some nested if statements again that I think you could un-nest a little bit
For Each item In mCollection
If IsEmpty(result) Then
result = item
Else
If item < result Then
result = item
End If
End If
Next item
so like this instead
For Each item In mCollection
If IsEmpty(result) Then
result = item
Else If item < result Then
result = item
End If
Next item
that will do the same thing with less nesting.
this can be done in both the Min and Max functions