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

前端 未结 4 950
半阙折子戏
半阙折子戏 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:35

    There is an "invisible" character at the beginning of your

    string ExecutionDay = "‎THURSDAY";
    

    and it is the LEFT-TO-RIGHT MARK. You can check it with:

    int len = ExecutionDay.Length; // 9 instead of 8
    

    and

    char ch = ExecutionDay[0]; // 8206
    

提交回复
热议问题