CSharpTest.Net
AddRange Method
See Also  Example Send Feedback Download Help File
CSharpTest.Net.Library Assembly > CSharpTest.Net.Collections Namespace > BTreeDictionary<TKey,TValue> Class : AddRange Method

items
The items to add to the ICollection.

Glossary Item Box

Adds a set of items to the ICollection.

Syntax

Visual Basic (Declaration) 
Public Sub AddRange( _
   ByVal items As IEnumerable(Of KeyValuePair(Of TKey,TValue)) _
) 
C# 
public void AddRange( 
   IEnumerable<KeyValuePair<TKey,TValue>> items
)

Parameters

items
The items to add to the ICollection.

Exceptions

ExceptionDescription
System.ArgumentExceptionAn element with the same key already exists in the IDictionary.
System.NotSupportedExceptionThe IDictionary is read-only.

Example

Library/Library.Test/TestBTreeDictionary.cs

C#Copy Code
BTreeDictionary<int, string> data = new BTreeDictionary<int, string>(Comparer, GetSample());
BTreeDictionary<int, string> copy = new BTreeDictionary<int, string>();
copy.AddRange(data);
Assert.AreEqual(copy.Count, data.Count);
foreach (int key in data.Keys)
    Assert.AreEqual(data[key], copy[key]);
VB.NETCopy Code
Dim data As New BTreeDictionary(Of Integer, String)(Comparer, GetSample())
Dim copy As New BTreeDictionary(Of Integer, String)()
copy.AddRange(data)
Assert.AreEqual(copy.Count, data.Count)
For Each key As Integer In data.Keys
    Assert.AreEqual(data(key), copy(key))
Next

Requirements

Target Platforms: Windows XP, Windows Server 2003, Windows Vista, Windows Server 2008, Windows 7

See Also

Generated with Document! X 2011 by Innovasys