CSharpTest.Net
TryGetValue(String,Uri) Method
See Also  Example Send Feedback Download Help File
CSharpTest.Net.Library Assembly > CSharpTest.Net.Serialization Namespace > Storage Class > TryGetValue Method : TryGetValue(String,Uri) Method

name
value

Glossary Item Box

Retrieves the named value from the storage

Syntax

Visual Basic (Declaration) 
Public Overloads Function TryGetValue( _
   ByVal name As String, _
   ByRef value As Uri _
) As Boolean
C# 
public bool TryGetValue( 
   string name,
   out Uri value
)

Parameters

name
value

Example

Library/Library.Test/TestStorage.cs

C#Copy Code
TestValues values = new TestValues();
            
//fails all but string
Store.SetValue("name", String.Empty);
Assert.IsTrue(Store.TryGetValue("name", out values._string));
Assert.AreEqual(String.Empty, values._string);

Assert.IsFalse(Store.TryGetValue("name", out values._bool));
Assert.IsFalse(Store.TryGetValue("name", out values._byte));
Assert.IsFalse(Store.TryGetValue("name", out values._char));
Assert.IsFalse(Store.TryGetValue("name", out values._DateTime));
Assert.IsFalse(Store.TryGetValue("name", out values._decimal));
Assert.IsFalse(Store.TryGetValue("name", out values._double));
Assert.IsFalse(Store.TryGetValue("name", out values._float));
Assert.IsFalse(Store.TryGetValue("name", out values._Guid));
Assert.IsFalse(Store.TryGetValue("name", out values._int));
Assert.IsFalse(Store.TryGetValue("name", out values._long));
Assert.IsFalse(Store.TryGetValue("name", out values._sbyte));
Assert.IsFalse(Store.TryGetValue("name", out values._short));
Assert.IsFalse(Store.TryGetValue("name", out values._TimeSpan));
Assert.IsFalse(Store.TryGetValue("name", out values._uint));
Assert.IsFalse(Store.TryGetValue("name", out values._ulong));
Assert.IsFalse(Store.TryGetValue("name", out values._Uri));
Assert.IsFalse(Store.TryGetValue("name", out values._ushort));
Assert.IsFalse(Store.TryGetValue("name", out values._Version));
Assert.IsFalse(Store.TryGetValue("name", ValuesA._object.GetType(), out values._object));
VB.NETCopy Code
Dim values As New TestValues()

'fails all but string
Store.SetValue("name", [String].Empty)
Assert.IsTrue(Store.TryGetValue("name", values._string))
Assert.AreEqual([String].Empty, values._string)

Assert.IsFalse(Store.TryGetValue("name", values._bool))
Assert.IsFalse(Store.TryGetValue("name", values._byte))
Assert.IsFalse(Store.TryGetValue("name", values._char))
Assert.IsFalse(Store.TryGetValue("name", values._DateTime))
Assert.IsFalse(Store.TryGetValue("name", values._decimal))
Assert.IsFalse(Store.TryGetValue("name", values._double))
Assert.IsFalse(Store.TryGetValue("name", values._float))
Assert.IsFalse(Store.TryGetValue("name", values._Guid))
Assert.IsFalse(Store.TryGetValue("name", values._int))
Assert.IsFalse(Store.TryGetValue("name", values._long))
Assert.IsFalse(Store.TryGetValue("name", values._sbyte))
Assert.IsFalse(Store.TryGetValue("name", values._short))
Assert.IsFalse(Store.TryGetValue("name", values._TimeSpan))
Assert.IsFalse(Store.TryGetValue("name", values._uint))
Assert.IsFalse(Store.TryGetValue("name", values._ulong))
Assert.IsFalse(Store.TryGetValue("name", values._Uri))
Assert.IsFalse(Store.TryGetValue("name", values._ushort))
Assert.IsFalse(Store.TryGetValue("name", values._Version))
Assert.IsFalse(Store.TryGetValue("name", ValuesA._object.[GetType](), values._object))

Requirements

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

See Also

Generated with Document! X 2011 by Innovasys