CSharpTest.Net
ToSecureString Method
See Also  Example Send Feedback Download Help File
CSharpTest.Net.Library Assembly > CSharpTest.Net.Crypto Namespace > Password Class : ToSecureString Method

Glossary Item Box

Returns a System.Security.SecureString from the password

Syntax

Visual Basic (Declaration) 
Public Function ToSecureString() As SecureString
C# 
public SecureString ToSecureString()

Example

Library/Library.Test/TestPassword.cs

C#Copy Code
using (Password p1 = new Password(TEST_PASSWORD))
using (SecureString sstr = p1.ToSecureString())
using (Password p2 = new Password(sstr))
{
    Assert.AreEqual(p1, p2);
}
VB.NETCopy Code
Using p1 As New Password(TEST_PASSWORD)
    Using sstr As SecureString = p1.ToSecureString()
        Using p2 As New Password(sstr)
            Assert.AreEqual(p1, p2)
        End Using
    End Using
End Using

Requirements

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

See Also

Generated with Document! X 2011 by Innovasys