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

other

Glossary Item Box

Returns true if the other object is equal to this one

Syntax

Visual Basic (Declaration) 
Public Overloads Function Equals( _
   ByVal other As Password _
) As Boolean
C# 
public bool Equals( 
   Password other
)

Parameters

other

Example

Library/Library.Test/TestPassword.cs

C#Copy Code
using (Password pwd1 = new Password(TEST_PASSWORD))
{
    using (Password pwd2 = new Password(TEST_PASSWORD))
    {
        Assert.AreEqual(pwd1, pwd2);
        Assert.IsTrue(Password.Equals(pwd1, pwd2));
        Assert.IsTrue(pwd1 == pwd2);
        Assert.IsFalse(pwd1 != pwd2);
        Assert.IsTrue(pwd1.Equals(pwd2));
        Assert.IsTrue(pwd1.Equals((object)pwd2));
        Assert.AreEqual(pwd1.GetHashCode(), pwd2.GetHashCode());
    }

    Assert.IsFalse(pwd1 == new Password("Not the same"));
    Assert.IsFalse(pwd1 == null);
    Assert.IsFalse(null == pwd1);
    Assert.IsFalse(pwd1.Equals(null));

    Assert.AreEqual(pwd1.GetHashCode(), Password.GetHashCode(pwd1));
}
VB.NETCopy Code
Using pwd1 As New Password(TEST_PASSWORD)
    Using pwd2 As New Password(TEST_PASSWORD)
        Assert.AreEqual(pwd1, pwd2)
        Assert.IsTrue(Password.Equals(pwd1, pwd2))
        Assert.IsTrue(pwd1 = pwd2)
        Assert.IsFalse(pwd1 <> pwd2)
        Assert.IsTrue(pwd1.Equals(pwd2))
        Assert.IsTrue(pwd1.Equals(DirectCast(pwd2, Object)))
        Assert.AreEqual(pwd1.GetHashCode(), pwd2.GetHashCode())
    End Using

    Assert.IsFalse(pwd1 = New Password("Not the same"))
    Assert.IsFalse(pwd1 = Nothing)
    Assert.IsFalse(Nothing = pwd1)
    Assert.IsFalse(pwd1.Equals(Nothing))

    Assert.AreEqual(pwd1.GetHashCode(), Password.GetHashCode(pwd1))
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