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

Glossary Item Box

Gets an ICollection containing the keys of the IDictionary.

Syntax

Visual Basic (Declaration) 
Public ReadOnly Property Keys As LurchTable(Of TKey,TValue)
C# 
public LurchTable<TKey,TValue> Keys {get;}

Example

Library/Library.Test/TestLurchTable.cs

C#Copy Code
var sample = GetSample();
var items = CreateSample(sample);
IDictionary<int, string> dict = items;
var keys = new List<int>();
foreach (var kv in sample)
    keys.Add(kv.Key);
VerifyCollection(EqualityComparer<int>.Default, keys.AsReadOnly(), items.Keys);
VerifyCollection(EqualityComparer<int>.Default, keys.AsReadOnly(), dict.Keys);
VB.NETCopy Code
Dim sample As var = GetSample()
Dim items As var = CreateSample(sample)
Dim dict As IDictionary(Of Integer, String) = items
Dim keys As var = New List(Of Integer)()
For Each kv As var In sample
    keys.Add(kv.Key)
Next
VerifyCollection(EqualityComparer(Of Integer).[Default], keys.AsReadOnly(), items.Keys)
VerifyCollection(EqualityComparer(Of Integer).[Default], keys.AsReadOnly(), dict.Keys)

Requirements

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

See Also

Generated with Document! X 2011 by Innovasys