C# StringDictionary Item

Description

StringDictionary Item gets or sets the value associated with the specified key.

Syntax

StringDictionary.Item has the following syntax.


public virtual string this[
  string key
] { get; set; }

Parameters

StringDictionary.Item has the following parameters.

  • key - The key whose value to get or set.

Example


using System;//from   w  w  w.  j a  va2  s.c o  m
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" );

      Console.WriteLine( myCol["red"] );
   }

}

The code above generates the following result.





















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




BitVector32
HybridDictionary
ListDictionary
OrderedDictionary
StringCollection
StringDictionary
StringEnumerator