C# HybridDictionary Item

Description

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

Syntax

HybridDictionary.Item has the following syntax.


public Object this[
  Object key
] { get; set; }

Parameters

HybridDictionary.Item has the following parameters.

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

Example


using System;/*from ww w. j  av a  2s .  com*/
using System.Collections;
using System.Collections.Specialized;

public class SamplesHybridDictionary  {
   public static void Main()  {
      HybridDictionary myCol = new HybridDictionary();
      myCol.Add( "F", "1.49" );
      myCol.Add( "A", "1.29" );
      myCol.Add( "B", "1.49" );

      String[] myKeys = new String[myCol.Count];
      myCol.Keys.CopyTo( myKeys, 0 );

      for ( int i = 0; i < myCol.Count; i++ )
         Console.WriteLine( "   {0,-5} {1,-25} {2}", i, myKeys[i], myCol[myKeys[i]] );
   }
}

The code above generates the following result.





















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




BitVector32
HybridDictionary
ListDictionary
OrderedDictionary
StringCollection
StringDictionary
StringEnumerator