C# StringCollection Contains
Description
StringCollection Contains
determines whether the specified
string is in the StringCollection.
Syntax
StringCollection.Contains
has the following syntax.
public bool Contains(
string value
)
Parameters
StringCollection.Contains
has the following parameters.
value
- The string to locate in the StringCollection. The value can be null.
Returns
StringCollection.Contains
method returns true if value is found in the StringCollection; otherwise, false.
Example
using System;//www. ja v a 2s .co m
using System.Collections;
using System.Collections.Specialized;
public class SamplesStringCollection {
public static void Main() {
StringCollection myCol = new StringCollection();
String[] myArr = new String[] { "A", "B", "C" };
myCol.AddRange( myArr );
Console.WriteLine(myCol.Contains( "A" ) );
}
}
The code above generates the following result.