Equals Method (Object)
Collapse the table of content
Expand the table of content

X509Certificate.Equals Method (Object)

[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]

Compares two X509Certificate objects for equality.

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

public override bool Equals(
	Object obj
)

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.



using System;
using System.Security.Cryptography.X509Certificates;


public class Example
{

   public static void Demo(System.Windows.Controls.TextBlock outputBlock)
   {

      // The path to the certificate.
      string Certificate = "Certificate.cer";
      string OtherCertificate = "OtherCertificate.cer";

      // Load the certificate into an X509Certificate object.
      X509Certificate cert = X509Certificate.CreateFromCertFile(Certificate);

      // Load the certificate into an X509Certificate object.
      X509Certificate certTwo = X509Certificate.CreateFromCertFile(OtherCertificate);

      // Get the value.
      bool result = cert.Equals(certTwo);

      // Display the value.
      outputBlock.Text += result + "\n";

   }

}


Windows Phone OS

Supported in: 8.1, 8.0, 7.1, 7.0

Windows Phone

Show:
© 2017 Microsoft