Why String.Equals is returning false?

前端 未结 3 684
傲寒
傲寒 2020-12-10 01:25

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.Thumb

3条回答
  •  眼角桃花
    2020-12-10 01:43

    You may wish to try using an overload of String.Equals that accepts a parameter of type StringComparison.

    For example:

    myCert.Thumbprint.Equals(certificateThumbprint, StringComparison.[SomeEnumeration])
    


    Where [SomeEnumeration] is replaced with one of the following enumerated constants:

     - CurrentCulture
     - CurrentCultureIgnoreCase
     - InvariantCulture
     - InvariantCultureIgnoreCase
     - Ordinal
     - OrdinalIgnoreCase
    


    Reference the MSDN Documentation found here. enter image description here

提交回复
热议问题