[DispatchObject] Simplify != operator and fix a potential NRE in Equals. (#4912)
This commit is contained in:
Родитель
fc0de6dee6
Коммит
043c31331f
|
@ -120,26 +120,14 @@ namespace CoreFoundation {
|
|||
|
||||
public static bool operator != (DispatchObject a, DispatchObject b)
|
||||
{
|
||||
var oa = a as object;
|
||||
var ob = b as object;
|
||||
|
||||
if (oa == null){
|
||||
if (ob == null)
|
||||
return false;
|
||||
return true;
|
||||
} else {
|
||||
if (ob == null)
|
||||
return true;
|
||||
return a.handle != b.handle;
|
||||
}
|
||||
return !(a == b);
|
||||
}
|
||||
|
||||
public override bool Equals (object other)
|
||||
{
|
||||
if (other == null)
|
||||
return false;
|
||||
|
||||
var od = other as DispatchQueue;
|
||||
if (od == null)
|
||||
return false;
|
||||
return od.handle == handle;
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче