C# StringDictionary ContainsValue

Description

StringDictionary ContainsValue determines if the StringDictionary contains a specific value.

Syntax

StringDictionary.ContainsValue has the following syntax.


public virtual bool ContainsValue(
  string value
)

Parameters

StringDictionary.ContainsValue has the following parameters.

  • value - The value to locate in the StringDictionary. The value can be null.

Returns

StringDictionary.ContainsValue method returns true if the StringDictionary contains an element with the specified value; otherwise, false.

Example


using System;//from   w  w  w .  j a  va2  s .c om
using System.Collections;
using System.Collections.Specialized;

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( "amarillo" ) )
         Console.WriteLine( "The collection contains the value \"amarillo\"." );
      else
         Console.WriteLine( "The collection does not contain the value \"amarillo\"." );
   }
}

The code above generates the following result.





















Home »
  C# Tutorial »
    System.Collections.Specialized »




BitVector32
HybridDictionary
ListDictionary
OrderedDictionary
StringCollection
StringDictionary
StringEnumerator