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

path
Optional path for context information
name
The name of the property
value
The value to store

Glossary Item Box

Writes the given property by name

Syntax

Visual Basic (Declaration) 
Sub Write( _
   ByVal path As String, _
   ByVal name As String, _
   ByVal value As String _
) 
C# 
void Write( 
   string path,
   string name,
   string value
)

Parameters

path
Optional path for context information
name
The name of the property
value
The value to store

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