Click here to Skip to main content
12,622,032 members (36,369 online)
Click here to Skip to main content

Tagged as

Stats

6.7K views
5 bookmarked
Posted

Trick when using Array.Contains()

, 13 Jun 2011 CPOL
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

Revisions


  

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

License

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

Share

About the Author

Ctznkane
United States United States
No Biography provided

You may also be interested in...

Pro
Pro
| Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.161128.1 | Last Updated 13 Jun 2011
Article Copyright 2011 by Ctznkane
Everything else Copyright © CodeProject, 1999-2016
Layout: fixed | fluid