-
Notifications
You must be signed in to change notification settings - Fork 91
Open
Description
rt,zstring类对象在调用Equals与非空对象比较时会抛空。看起来是由于Equals内会将obj转为zstring类并进行非空判定,但重写的!=运算符号直接尝试获取left与right的value导致的
` public override bool Equals(object obj)
{
if (obj == null)
return ReferenceEquals(this, null);
var gstr = obj as zstring;
if (gstr != null)
return gstr._value == this._value;
var str = obj as string;
if (str != null)
return str == this._value;
return false;
}`
public static bool operator !=(zstring left, zstring right) { return !(left._value == right._value); }
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels