Array.IList.Contains Method

[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]

Determines whether an element is in the Array.

Namespace:  System
Assembly:  mscorlib (in mscorlib.dll)

Syntax

Private Function Contains ( _
    value As Object _
) As Boolean Implements IList.Contains
bool IList.Contains(
    Object value
)

Parameters

  • value
    Type: System..::.Object
    The object to locate in the Array. The element to locate can be nullNothingnullptra null reference (Nothing in Visual Basic) for reference types.

Return Value

Type: System..::.Boolean
true if value is found in the Array; otherwise, false.

Implements

IList..::.Contains(Object)

Exceptions

Exception Condition
RankException

The current Array is multidimensional.

Remarks

This method performs a linear search; therefore, this method is an O(n) operation, where n is ICollection..::.Count.

This method determines equality by calling the Object..::.Equals method.

This method is an O(n) operation, where n is Length.

Version Information

Windows Phone OS

Supported in: 8.1, 8.0, 7.1, 7.0

Platforms

Windows Phone

See Also

Reference

Array Class

System Namespace

IndexOf

LastIndexOf