????3.Equals????写
?????????????????
????string a = new string(new char[] { 'h'?? 'e'?? 'l'?? 'l'?? 'o' });
????string b = new string(new char[] { 'h'?? 'e'?? 'l'?? 'l'?? 'o' });
????Console.WriteLine(a == b);         //true
????Console.WriteLine(a.Equals(b));    //true
????????????a ??b ???????????????Equals?True??????????“Equals??????????????????????????“?????????????????String???械?Equals??????
????public override bool Equals(Object obj) <br>       {
????if (this == null)                        //this is necessary to guard against reverse-pinvokes and
????throw new NullReferenceException();  //other callers who do not use the callvirt instruction
????String str = obj as String;
????if (str == null)
????return false;
????if (Object.ReferenceEquals(this?? obj))
????return true;
????if (this.Length != str.Length)
????return false;
????return EqualsHelper(this?? str);
????}
????public bool Equals(String value) <br>       {
????if (this == null)                        //this is necessary to guard against reverse-pinvokes and
????throw new NullReferenceException();  //other callers who do not use the callvirt instruction
????if (value == null)
????return false;
????if (Object.ReferenceEquals(this?? value))
????return true;
????if (this.Length != value.Length)
????return false;
????return EqualsHelper(this?? value);
????}
????????????String???胁?????写??Object?械?Equals?????????Equals????????????????????????????????????????????????????????????????Equals??????????????????????????????慰????????????写??????濉�??????写Equals???????????????????????????HashMap??HashSet??Hashtable???????????写GetHashCode()??
????4.???????“==”?????Equals??
?????泄?????浠�??“?魏??????????????????????????”?????“==”??Equals????????“==” ???????????谢???????????????????????????????锟�???????????????????????????????????????????????????????????????????????????????????械?????????????????? “???????????“ ??????????????????????? ?纾篠tring???????????????????????????????????????械?????????????????????????????????????????位??????危????????????????????????????械?????????????????????????????????????????????????????????????????????????????????????????????????????????位???????????” ????????????????????“ ?????????????????????
????5.“==”??Equals???????????
????”==“ ???????Equals??????????????????????”==“ ??????????????????? ”?????????????????????” ??????????Equals??????????????????????????????????????????????????????????????????????????????????????????Object?????Equals??Visual????????卸???写?????????????????????????????????????????????????????????????妫�
????object g = a;
????object h = b;
????Console.WriteLine(g == h);         //false
????Console.WriteLine(g.Equals(h));    //true
???????Object???????????????????“==”????????“==”??????????????????????娲�?????????????????Equals???????String???械?Equals?????g???????????????????????????????????????????Object???????Visual studio??????????????????????????
???????魏味??????????????”==“??Equals???????