diff --git a/src/AssetsLibrary/ALAsset.cs b/src/AssetsLibrary/ALAsset.cs index 5e6794d69216..7a0a8344d347 100644 --- a/src/AssetsLibrary/ALAsset.cs +++ b/src/AssetsLibrary/ALAsset.cs @@ -47,7 +47,7 @@ public double Duration { // note: this can return an NSString like: ALErrorInvalidProperty // which causes an InvalidCastException with a normal cast var n = ValueForProperty (_PropertyDuration) as NSNumber; - return n == null ? double.NaN : n.DoubleValue; + return n?.DoubleValue ?? double.NaN; } } @@ -81,9 +81,7 @@ public NSUrl? AssetUrl { get { // do not show an ArgumentNullException inside the // debugger for releases before 6.0 - if (_PropertyAssetURL == null) - return null; - return (NSUrl) ValueForProperty (_PropertyAssetURL); + return _PropertyAssetURL is not null ? (NSUrl) ValueForProperty (_PropertyAssetURL) : null; } } }