Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

X509Certificate.Equals Method (Object)

Compares two X509Certificate objects for equality.

Namespace:  System.Security.Cryptography.X509Certificates
Assembly:  mscorlib (in mscorlib.dll)

'Declaration
<ComVisibleAttribute(False)> _
Public Overrides Function Equals ( _
	obj As Object _
) As Boolean

Parameters

obj
Type: System.Object
An object to compare to the current object.

Return Value

Type: System.Boolean
true if the current X509Certificate object is equal to the object specified by the other parameter; otherwise, false.

The following example compares two certificates for equality.


Imports System.Security.Cryptography.X509Certificates




Public Class Example


   Public Shared Sub Demo(ByVal outputBlock As System.Windows.Controls.TextBlock)

      ' The path to the certificate.
      Dim Certificate As String = "Certificate.cer"
      Dim OtherCertificate As String = "OtherCertificate.cer"

      ' Load the certificate into an X509Certificate object.
      Dim cert As X509Certificate = X509Certificate.CreateFromCertFile(Certificate)

      ' Load the certificate into an X509Certificate object.
      Dim certTwo As X509Certificate = X509Certificate.CreateFromCertFile(OtherCertificate)

      ' Get the value.
      Dim result As Boolean = cert.Equals(certTwo)

      ' Display the value.
      outputBlock.Text &= result & vbCrLf
   End Sub
End Class



Silverlight

Supported in: 5, 4, 3

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1, Windows Phone OS 7.0

XNA Framework

Supported in: Windows Phone OS 7.0

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.

Community Additions

ADD
Show:
© 2015 Microsoft