ArrayList: Contains

Contains

Returns if the list contains a specific value.



 Public Function Contains(
	  ByRef Value As Variant,
	  Optional ByVal Comparer As IComparer ) As Boolean

Parameters

Value
[ByRef] Variant. The value to search for.
Comparer
[ByVal] Optional. IComparer. A user-defined comparer to performs custom compare logic on the array elements.

Return Values

Boolean -  A boolean value indicating the value was found in the list.

Remarks

This method performs a linear search of all elements in the list comparing each element with the value being searched for. If the value is an object, then if it implements the cObject interface, then the Equals method is used to test equality, otherwise the Is operator is use to compare two objects.

If there is special compare logic necessary, then a comparer object can be supplied. The compare object must implement the IComparer interface.

See Also

Class ArrayList Overview ArrayList Properties ArrayList Methods CloneHelper CopyTo