????????????????
??????.Net????У??????????????????????????Щ??????????????????????????????
????1 float num1 = 2.000000f;
????2 float num2 = 2.000001f;
????3
????4 Console.WriteLine(num1 == num2);
???????????????????????????????????????????????????????????β????????????????????г????????????????????True??
????????????????????????????????????????????ì?????????????????2?????????????????????????????????????float???????洢??????Ч???????????????????????????????????????????????????????????
????1 float num1 = 0.7f;
????2 float num2 = 0.6f + 0.1f;
????3
????4 Console.WriteLine(num2);
????5 Console.WriteLine(num1 == num2);
???????????????????????0.6??0.1?????????????????????0.7?????????????г????????????????????False?????????False???????????????????0.7???????????????????????????г????????????????洢???????????????????num2?????String???????????????????????0.7??????num2???????????0.7??

?????????????ζ???ж????????????????????????.Net????????????????????????????????????????????????????????????????????????????????????????????????С???????????????????£?????????????????????С????????????????????????
??????stackoverflow???????????????????????ο???https://stackoverflow.com/questions/6598179/the-right-way-to-compare-a-system-double-to-0-a-number-int??
?????????????????????ì??
????????????????????????????????е???????????????????????????????????????????????????????????????????д??????????????????Bug??
?????????????????????????????????????л???Animal?????????????Dog?????????
????1 public class Animal
????2 {
????3
????4 }
????5
????6 public class Dog : Animal
????7 {
????8
????9 }
????????????????Animal????????????????????Animal??????????????????IEquatable<Animal>????????????????Equals()????????Animal?????????????????
1 public class Animal : IEquatable<animal>
????2 {
????3     public virtual bool Equals(Animal other)
????4     {
????5         throw new NotImplementedException();
????6     }
????7 }
??????????????Dog?????????????????????Dog????????????????????IEquatable<Dog>??????ζ????????????Equals()????????Dog?????????????????
????1 public class Dog : Animal?? IEquatable<Dog>
????2 {
????3     public virtual bool Equals(Dog other)
????4     {
????5         throw new NotImplementedException();
????6     }
????7 }
??????????????????????????????????OOP?????У???????????Dog?????Animal???Equals()???????????鷳????Dog??Equals()??????Animal???Equals()?????????????????????????????д????Animal???Equals()????????????????????????????????Equals???????????????????
?????????????????дObject????Equals???????÷??????????Object??????????????????ζ??????????????????????????????д????????????????????????????
???????
????C#????????????????????????????ζ???????????????????????"=="????????????У?
?????????????????????ж??.Net???????????????????????????????????д????????????????????????????
???????????????????????????????????????????????????????
???????????????????????????????????????