C# OrderedDictionary Clear
Description
OrderedDictionary Clear
removes all elements from the
OrderedDictionary collection.
Syntax
OrderedDictionary.Clear
has the following syntax.
public void Clear()
Returns
OrderedDictionary.Clear
method returns
Example
using System;//from w w w . j ava2 s . co m
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");
myOrderedDictionary.Clear();
myOrderedDictionary.Add("newKey1", "newValue1");
myOrderedDictionary.Add("newKey2", "newValue2");
myOrderedDictionary.Add("newKey3", "newValue3");
}
}