随笔分类 - Effective.C#.50.Improve
Effective C# 50 Specific Ways to Improve Your c# (Second Edition)
C# 高效编程-改进c#代码的50个行之有效的办法(第二版)。
摘要:当我们定义自己的类型时(无论是类还是Struct),应该为类型定义等同性的含义。C#定义了4中不同的函数来判断两个对象是否“相等”。1.public static bool ReferenceEquals(object left,objec right)2.public static bool Equals(object left,object right);3.public virtual bool Equals(object right);4.public static bool operator ==(MyClas left,MyClass right);对于前两种静态函数,我们永远都应
阅读全文

浙公网安备 33010602011771号