sathish
what is mean by StringDictionary and in what cases it ll be used?? simple example also needed ...
By sathish in ASP.NET on Feb 16 2011
  • sarika jain
    Feb, 2011 22

    StringDictionary Class implements a hash table with the key and the value to be strings rather than objects.And here it must be noted that key cannot be a  null reference whereas the value can.Key is in case-insensitive manner means it is translated to lowercase before it is used with StringDictionary.


    public static void Main(string[] args)
    {
    StringDictionary obj=new StringDictionary();
    obj.Add("host1","Server1");
    obj.Add("port","1234");
    obj.Add("userid","admin");

    foreach(DictionaryEntry de in obj)
    {
    Console.WriteLine("{0} = {1}",de.Key,de.Value);
    }
    }
    Each element of the StringDictionary class is a key/value pair of the type DictionaryEntry.

    • 0
  • Jaganathan Bantheswaran
    Feb, 2011 16

    HI,

    The StringDictionary implements a hash table with the key and the value strongly typed to be strings rather than objects.

    StringDictionary myCol = new StringDictionary();

          myCol.Add( "red", "rojo" );
    myCol.Add( "green", "verde");

    Console.WriteLine( "Displays the elements in the array:" );
    Console.WriteLine( " KEY VALUE" );
    for ( int i = 0; i < myArr.Length; i++ )
    Console.WriteLine( " {0,-10} {1}", myArr[i].Key, myArr[i].Value );

    Console.WriteLine();
    This class has more useful methods.

    • 0


Most Popular Job Functions


MOST LIKED QUESTIONS