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

Glossary Item Box

Retrives the key comparer being used by this instance.

Syntax

Visual Basic (Declaration) 
Public ReadOnly Property Comparer As IEqualityComparer(Of TKey)
C# 
public IEqualityComparer<TKey> Comparer {get;}

Example

Library/Library.Test/TestLurchTable.cs

C#Copy Code
var cmp = new IntComparer();
const int limit = 5;

Assert.AreEqual(LurchTableOrder.None, new LurchTable<int, int>(1).Ordering);
Assert.AreEqual(LurchTableOrder.Insertion, new LurchTable<int, int>(1, LurchTableOrder.Insertion).Ordering);
Assert.IsTrue(ReferenceEquals(cmp, new LurchTable<int, int>(1, LurchTableOrder.Insertion, cmp).Comparer));
Assert.AreEqual(LurchTableOrder.Modified, new LurchTable<int, int>(LurchTableOrder.Modified, limit).Ordering);
Assert.AreEqual(limit, new LurchTable<int, int>(LurchTableOrder.Modified, limit).Limit);
Assert.AreEqual(LurchTableOrder.Access, new LurchTable<int, int>(LurchTableOrder.Access, limit, cmp).Ordering);
Assert.AreEqual(limit, new LurchTable<int, int>(LurchTableOrder.Access, limit, cmp).Limit);
Assert.IsTrue(ReferenceEquals(cmp, new LurchTable<int, int>(LurchTableOrder.Access, limit, cmp).Comparer));
Assert.AreEqual(LurchTableOrder.Access, new LurchTable<int, int>(LurchTableOrder.Access, limit, 1, 1, 1, cmp).Ordering);
Assert.AreEqual(limit, new LurchTable<int, int>(LurchTableOrder.Access, limit, 1, 1, 1, cmp).Limit);
Assert.IsTrue(ReferenceEquals(cmp, new LurchTable<int, int>(LurchTableOrder.Access, limit, 1, 1, 1, cmp).Comparer));
VB.NETCopy Code
Dim cmp As var = New IntComparer()
Const  limit As Integer = 5

Assert.AreEqual(LurchTableOrder.None, New LurchTable(Of Integer, Integer)(1).Ordering)
Assert.AreEqual(LurchTableOrder.Insertion, New LurchTable(Of Integer, Integer)(1, LurchTableOrder.Insertion).Ordering)
Assert.IsTrue(ReferenceEquals(cmp, New LurchTable(Of Integer, Integer)(1, LurchTableOrder.Insertion, cmp).Comparer))
Assert.AreEqual(LurchTableOrder.Modified, New LurchTable(Of Integer, Integer)(LurchTableOrder.Modified, limit).Ordering)
Assert.AreEqual(limit, New LurchTable(Of Integer, Integer)(LurchTableOrder.Modified, limit).Limit)
Assert.AreEqual(LurchTableOrder.Access, New LurchTable(Of Integer, Integer)(LurchTableOrder.Access, limit, cmp).Ordering)
Assert.AreEqual(limit, New LurchTable(Of Integer, Integer)(LurchTableOrder.Access, limit, cmp).Limit)
Assert.IsTrue(ReferenceEquals(cmp, New LurchTable(Of Integer, Integer)(LurchTableOrder.Access, limit, cmp).Comparer))
Assert.AreEqual(LurchTableOrder.Access, New LurchTable(Of Integer, Integer)(LurchTableOrder.Access, limit, 1, 1, 1, cmp).Ordering)
Assert.AreEqual(limit, New LurchTable(Of Integer, Integer)(LurchTableOrder.Access, limit, 1, 1, 1, cmp).Limit)
Assert.IsTrue(ReferenceEquals(cmp, New LurchTable(Of Integer, Integer)(LurchTableOrder.Access, limit, 1, 1, 1, cmp).Comparer))

Requirements

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

See Also

Generated with Document! X 2011 by Innovasys