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

key
The key of the element to get or set.

Glossary Item Box

Gets or sets the element with the specified key.

Syntax

Visual Basic (Declaration) 
Public Default Property Item( _
   ByVal key As TKey _
) As TValue
C# 
public TValue this[ 
   TKey key
]; {get; set;}

Parameters

key
The key of the element to get or set.

Property Value

The element with the specified key.

Exceptions

ExceptionDescription
System.Collections.Generic.KeyNotFoundExceptionThe property is retrieved and key is not found.
System.NotSupportedExceptionThe property is set and the 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