Skip to Content
VB.NET Language in a Nutshell, Second Edition
book

VB.NET Language in a Nutshell, Second Edition

by Steven Roman PhD, Ron Petrusha, Paul Lomax
April 2002
Intermediate to advanced
688 pages
19h 51m
English
O'Reilly Media, Inc.
Content preview from VB.NET Language in a Nutshell, Second Edition

Name

Stack.Contains Method

Class

System.Collections.Stack

Syntax

                  stackvariable.Contains(obj)
obj (required; any)

The value to search for in the stack

Return Value

Boolean (True or False) indicating whether obj is found in the stack

Description

Returns a Boolean indicating whether a given element (Object) is somewhere in the stack

Rules at a Glance

  • obj must correspond exactly to an item in the stack for the method to return True.

  • String comparison is case sensitive and is not affected by the setting of Option Compare.

  • The Contains method searches the stack sequentially. In other words, its performance is inversely proportional to the number of items in the stack.

Programming Tips and Gotchas

  • In comparing objects in the stack with obj, the Contains method in turn calls the BCL’s Object.Equals method to perform the comparison. The Equals method returns True if two object instances are the same instance.

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

VB .NET Language in a Nutshell

VB .NET Language in a Nutshell

Steven Roman PhD, Ron Petrusha, Paul Lomax

Publisher Resources

ISBN: 0596003080Supplemental ContentCatalog PageErrata