C# OrderedDictionary AsReadOnly

Description

OrderedDictionary AsReadOnly returns a read-only copy of the current OrderedDictionary collection.

Syntax

OrderedDictionary.AsReadOnly has the following syntax.


public OrderedDictionary AsReadOnly()

Returns

OrderedDictionary.AsReadOnly method returns A read-only copy of the current OrderedDictionary collection.

Example


//from   w  w w. j a  v  a 2  s.c o  m
using System;
using System.Collections;
using System.Collections.Specialized;

public class SamplesStringCollection  {

   public static void Main()  {
        OrderedDictionary myOrderedDictionary = new OrderedDictionary();
        myOrderedDictionary.Add("testKey1", "testValue1");
        myOrderedDictionary.Add("testKey2", "testValue2");
        myOrderedDictionary.Add("testKey3", "testValue3");

        OrderedDictionary my = myOrderedDictionary.AsReadOnly();
   }

}

The code above generates the following result.





















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




BitVector32
HybridDictionary
ListDictionary
OrderedDictionary
StringCollection
StringDictionary
StringEnumerator