CSharpTest.Net
TryAdd(TKey,TValue) Method
See Also  Example Send Feedback Download Help File
CSharpTest.Net.BPlusTree Assembly > CSharpTest.Net.Collections Namespace > BPlusTree<TKey,TValue> Class > TryAdd Method : TryAdd(TKey,TValue) Method

key
value

Glossary Item Box

Adds an element with the provided key and value to the IDictionary.

Syntax

Visual Basic (Declaration) 
Public Overloads Function TryAdd( _
   ByVal key As TKey, _
   ByVal value As TValue _
) As Boolean
C# 
public bool TryAdd( 
   TKey key,
   TValue value
)

Parameters

key
value

Example

BPlusTree/BPlusTree.Test/TestFileSerialized.cs

C#Copy Code
try
{
    using (BPlusTree<int, string> tree = new BPlusTree<int, string>(Options))
    {
        Assert.IsTrue(tree.TryAdd(1, "hi"));
        TempFile.Delete();
    }
    Assert.Fail();
}
catch(IOException) { }
VB.NETCopy Code
Try
    Using tree As New BPlusTree(Of Integer, String)(Options)
        Assert.IsTrue(tree.TryAdd(1, "hi"))
        TempFile.Delete()
    End Using
    Assert.Fail()
Catch generatedExceptionName As IOException
End Try

Requirements

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

See Also

Generated with Document! X 2011 by Innovasys