CSharpTest.Net
Read Method
See Also  Example Send Feedback Download Help File
CSharpTest.Net.Library Assembly > CSharpTest.Net.Serialization Namespace > INameValueStore Interface : Read Method

path
Optional path for context information
name
The name of the property
value
Returns the output value if available

Glossary Item Box

returns true if the property was successfully retireved into the output variable 'value'

Syntax

Visual Basic (Declaration) 
Function Read( _
   ByVal path As String, _
   ByVal name As String, _
   ByRef value As String _
) As Boolean
C# 
bool Read( 
   string path,
   string name,
   out string value
)

Parameters

path
Optional path for context information
name
The name of the property
value
Returns the output value if available

Return Value

true if successful or false if data not available

Example

Library/Library.Test/TestSerializers.cs

C#Copy Code
string value;

Store.Write(null, "<?a", "b");

Assert.IsTrue(Store.Read(null, "<?a", out value));
Assert.AreEqual("b", value);

Assert.IsTrue(Store.Read(String.Empty, "<?a", out value));
Assert.AreEqual("b", value);

Store.Write(null, "<?a", "b");

Assert.IsTrue(Store.Read(null, "<?a", out value));
Assert.AreEqual("b", value);

Assert.IsTrue(Store.Read(String.Empty, "<?a", out value));
Assert.AreEqual("b", value);

Store.Write(">?1/\\", "<?a", "c");

Assert.IsTrue(Store.Read(String.Empty, "<?a", out value));
Assert.AreEqual("b", value);

Assert.IsTrue(Store.Read(">?1/\\", "<?a", out value));
Assert.AreEqual("c", value);

Store.Delete(">?1/\\", "<?a");
Assert.IsFalse(Store.Read(">?1/\\", "<?a", out value));

Store.Delete(null, "<?a");
Assert.IsFalse(Store.Read(null, "<?a", out value));
Assert.IsFalse(Store.Read(String.Empty, "<?a", out value));
VB.NETCopy Code
Dim value As String

Store.Write(Nothing, "<?a", "b")

Assert.IsTrue(Store.Read(Nothing, "<?a", value))
Assert.AreEqual("b", value)

Assert.IsTrue(Store.Read([String].Empty, "<?a", value))
Assert.AreEqual("b", value)

Store.Write(Nothing, "<?a", "b")

Assert.IsTrue(Store.Read(Nothing, "<?a", value))
Assert.AreEqual("b", value)

Assert.IsTrue(Store.Read([String].Empty, "<?a", value))
Assert.AreEqual("b", value)

Store.Write(">?1/\", "<?a", "c")

Assert.IsTrue(Store.Read([String].Empty, "<?a", value))
Assert.AreEqual("b", value)

Assert.IsTrue(Store.Read(">?1/\", "<?a", value))
Assert.AreEqual("c", value)

Store.Delete(">?1/\", "<?a")
Assert.IsFalse(Store.Read(">?1/\", "<?a", value))

Store.Delete(Nothing, "<?a")
Assert.IsFalse(Store.Read(Nothing, "<?a", value))
Assert.IsFalse(Store.Read([String].Empty, "<?a", value))

Requirements

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

See Also

Generated with Document! X 2011 by Innovasys