Visual Basic (Declaration) | |
---|---|
Public Overloads Function AddOrUpdate( _ ByVal key As TKey, _ ByVal addValue As TValue, _ ByVal fnUpdate As CSharpTest.Net.Collections.KeyValueUpdate(Of TKey,TValue) _ ) As TValue |
C# | |
---|---|
public TValue AddOrUpdate( TKey key, TValue addValue, CSharpTest.Net.Collections.KeyValueUpdate<TKey,TValue> fnUpdate ) |
Parameters
- key
- addValue
- fnUpdate
Library/Library.Test/TestLurchTable.cs
C# | Copy Code |
---|---|
var data = new LurchTableTest<int, string>(); Assert.AreEqual("a", data.AddOrUpdate(1, "a", (k, v) => k.ToString())); Assert.AreEqual("1", data.AddOrUpdate(1, "a", (k, v) => k.ToString())); Assert.AreEqual("b", data.AddOrUpdate(2, k => "b", (k, v) => k.ToString())); Assert.AreEqual("2", data.AddOrUpdate(2, k => "b", (k, v) => k.ToString())); |
VB.NET | Copy Code |
---|---|
Dim data As var = New LurchTableTest(Of Integer, String)() Assert.AreEqual("a", data.AddOrUpdate(1, "a", Function(k, v) k.ToString())) Assert.AreEqual("1", data.AddOrUpdate(1, "a", Function(k, v) k.ToString())) Assert.AreEqual("b", data.AddOrUpdate(2, Function(k) "b", Function(k, v) k.ToString())) Assert.AreEqual("2", data.AddOrUpdate(2, Function(k) "b", Function(k, v) k.ToString())) |
Target Platforms: Windows XP, Windows Server 2003, Windows Vista, Windows Server 2008, Windows 7
Reference
LurchTable<TKey,TValue> ClassLurchTable<TKey,TValue> Members
Overload List
KeyValueUpdate