public static void DisposeEx(this INativeObject nativeObject) { if (!nativeObject.IsAlive() || TryDispose(nativeObject)) { return; } var view = nativeObject as UIView; if (view == null) { (nativeObject as IDisposable)?.Dispose(); } else { DisposeView(view); } }