[DispatchObject] Simplify != operator and fix a potential NRE in Equals. (#4912)

This commit is contained in:
Rolf Bjarne Kvinge 2018-10-03 14:29:11 +02:00 коммит произвёл GitHub
Родитель fc0de6dee6
Коммит 043c31331f
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
1 изменённых файлов: 3 добавлений и 15 удалений

Просмотреть файл

@ -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;
}