Export (0) Print
Expand All

Stack.Contains Method

Determines whether an element is in the Stack.

[Visual Basic]
Public Overridable Function Contains( _
   ByVal obj As Object _
) As Boolean
[C#]
public virtual bool Contains(
 object obj
);
[C++]
public: virtual bool Contains(
 Object* obj
);
[JScript]
public function Contains(
   obj : Object
) : Boolean;

Parameters

obj
The Object to locate in the Stack. The value can be a null reference (Nothing in Visual Basic).

Return Value

true if obj is found in the Stack; otherwise, false.

Remarks

This method performs a linear search; therefore, the average execution time is proportional to Count. That is, this method is an O(n) operation, where n is Count.

This method determines equality by calling Object.Equals.

Requirements

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

See Also

Stack Class | Stack Members | System.Collections Namespace | Performing Culture-Insensitive String Operations

Show:
© 2014 Microsoft