String.Equals vs String.Compare vs “==” in Action. Explanation needed

前端 未结 4 955
半阙折子戏
半阙折子戏 2021-02-20 06:59

Following is the code snippet from a console application -

class MyClass
{        
   public int GetDay(string data22)
    {
        int returnValue = 0;

              


        
4条回答
  •  鱼传尺愫
    2021-02-20 07:48

    The ExecutionDay string contains invisible characters, otherwise all checks would be true

    The following lines return a different length, 9 and 8 respectively

            Console.WriteLine(ExecutionDay.Length);
            Console.WriteLine("THURSDAY".Length);
    

提交回复
热议问题