Using == or Equals for string comparison

后端 未结 5 1096
抹茶落季
抹茶落季 2020-12-14 23:48

In some languages (e.g. C++) you can\'t use operators like == for string comparisons as that would compare the address of the string object, and not the string itself. Howev

5条回答
  •  情话喂你
    2020-12-15 00:31

    This is the implementation of the operator:

        public static bool operator == (String a, String b) {
           return String.Equals(a, b);
        }
    

    Don't lose any sleep over this.

提交回复
热议问题