Why String.Equals is returning false?
I have the following C# code (from a library I'm using) that tries to find a certificate comparing the thumbprint. Notice that in the following code both mycert.Thumbprint and certificateThumbprint are strings. var certificateThumbprint = AppSettings.CertificateThumbprint; var cert = myStore.Certificates.OfType<X509Certificate2>().FirstOrDefault( mycert => mycert.Thumbprint != null && mycert.Thumbprint.Equals(certificateThumbprint) ); This fails to find the certificate with the thumbprint because mycert.Thumbprint.Equals(certificateThumbprint) is false even when the strings are equal. mycert