Click here to Skip to main content
Click here to Skip to main content
Add your own
alternative version

Tagged as

Go to top

Trick when using Array.Contains()

, 13 Jun 2011
The Array class already contains this capability with no casting required. The IndexOf method is a static one that returns the index of the value and a -1 if it doesn't exist.Here is an example:exists = Array.IndexOf(arr, "item") >= 0



Compare Revision Minor Date Status Editor
publicly available No 13-Jun-11 11:43 Available Deeksha Shenoy
2 No 13-Jun-11 11:05 Available Smitha Vijayan
1 No 13-Jun-11 9:57 Composing Ctznkane


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author


United States United States
No Biography provided

| Advertise | Privacy | Mobile
Web01 | 2.8.140916.1 | Last Updated 13 Jun 2011
Article Copyright 2011 by Ctznkane
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid