CSharpTest.Net
Delete Method
See Also  Example Send Feedback Download Help File
CSharpTest.Net.Library Assembly > CSharpTest.Net.Serialization Namespace > Storage Class : Delete Method

name

Glossary Item Box

Removes the named value from the storage

Syntax

Visual Basic (Declaration) 
Public Sub Delete( _
   ByVal name As String _
) 
C# 
public void Delete( 
   string name
)

Parameters

name

Example

Library/Library.Test/TestStorage.cs

C#Copy Code
Version data = new Version(1, 2, 3, 4);
Store.SetValue("a", data);
Assert.AreEqual(data, Store.GetValue("a", (Version)null));

Store.Delete("a");
Assert.AreEqual(new Version(1, 0), Store.GetValue("a", new Version(1, 0)));

Store.SetValue("a", data);
Assert.AreEqual(data, Store.GetValue("a", (Version)null));
        
Store.SetValue("a", (string)null);//set null will delete
Assert.AreEqual(new Version(1, 0), Store.GetValue("a", new Version(1, 0)));
VB.NETCopy Code
Dim data As New Version(1, 2, 3, 4)
Store.SetValue("a", data)
Assert.AreEqual(data, Store.GetValue("a", DirectCast(Nothing, Version)))

Store.Delete("a")
Assert.AreEqual(New Version(1, 0), Store.GetValue("a", New Version(1, 0)))

Store.SetValue("a", data)
Assert.AreEqual(data, Store.GetValue("a", DirectCast(Nothing, Version)))

Store.SetValue("a", DirectCast(Nothing, String))
'set null will delete
Assert.AreEqual(New Version(1, 0), Store.GetValue("a", New Version(1, 0)))

Requirements

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

See Also

Generated with Document! X 2011 by Innovasys