Check if the StringDictionary contains a specific value in CSharp
Description
The following code shows how to check if the StringDictionary contains a specific value.
Example
using System.Collections;
using System.Collections.Specialized;
//from w w w . j av a 2 s . c o m
public class SamplesStringDictionary {
public static void Main() {
StringDictionary myCol = new StringDictionary();
myCol.Add( "red", "rojo" );
myCol.Add( "green", "verde" );
myCol.Add( "blue", "azul" );
if ( myCol.ContainsValue( "XML" ) )
System.Console.WriteLine( "contain" );
else
System.Console.WriteLine( "not contain" );
}
}
The code above generates the following result.