Skip to content
This repository was archived by the owner on May 1, 2024. It is now read-only.

Commit 24d4074

Browse files
committed
Simplified syntax as requested
1 parent 1729f36 commit 24d4074

File tree

1 file changed

+4
-18
lines changed

1 file changed

+4
-18
lines changed

src/CommunityToolkit/Xamarin.CommunityToolkit/Extensions/JavaObjectExtensions.android.cs

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -5,29 +5,15 @@ namespace Xamarin.CommunityToolkit.Extensions
55
internal static class JavaObjectExtensions
66
{
77
public static bool IsDisposed(this Java.Lang.Object obj)
8-
{
9-
return obj.Handle == IntPtr.Zero;
10-
}
8+
=> obj.Handle == IntPtr.Zero;
119

1210
public static bool IsAlive(this Java.Lang.Object obj)
13-
{
14-
if (obj == null)
15-
return false;
16-
17-
return !obj.IsDisposed();
18-
}
11+
=> obj != null && !obj.IsDisposed();
1912

2013
public static bool IsDisposed(this global::Android.Runtime.IJavaObject obj)
21-
{
22-
return obj.Handle == IntPtr.Zero;
23-
}
14+
=> obj.Handle == IntPtr.Zero;
2415

2516
public static bool IsAlive(this global::Android.Runtime.IJavaObject obj)
26-
{
27-
if (obj == null)
28-
return false;
29-
30-
return !obj.IsDisposed();
31-
}
17+
=> obj != null && !obj.IsDisposed();
3218
}
3319
}

0 commit comments

Comments
 (0)