C# ListDictionary CopyTo
Description
ListDictionary CopyTo
copies the ListDictionary entries
to a one-dimensional Array instance at the specified index.
Syntax
ListDictionary.CopyTo
has the following syntax.
public void CopyTo(
Array array,
int index
)
Parameters
ListDictionary.CopyTo
has the following parameters.
array
- The one-dimensional Array that is the destination of the DictionaryEntry objects copied from ListDictionary. The Array must have zero-based indexing.index
- The zero-based index in array at which copying begins.
Returns
ListDictionary.CopyTo
method returns
Example
using System;// w w w. j a v a2 s .c o m
using System.Collections;
using System.Collections.Specialized;
public class SamplesListDictionary {
public static void Main() {
ListDictionary myCol = new ListDictionary();
myCol.Add( "F", "1.49" );
myCol.Add( "A", "1.29" );
myCol.Add( "B", "1.49" );
myCol.Add( "C", "1.29" );
myCol.Add( "D", "0.89" );
myCol.Add( "E", "0.99" );
DictionaryEntry[] myArr = new DictionaryEntry[myCol.Count];
myCol.CopyTo( myArr, 0 );
}
}