diff options
author | Jesse Plamondon-Willard <Pathoschild@users.noreply.github.com> | 2022-04-06 18:24:59 -0400 |
---|---|---|
committer | Jesse Plamondon-Willard <Pathoschild@users.noreply.github.com> | 2022-04-06 18:24:59 -0400 |
commit | b6c8cfc28b2c94e6dc3cb07d3058371dd6775e70 (patch) | |
tree | 4614e6eeb590843c7769f3b1857b71bdfa759071 /src/SMAPI/Framework/Content | |
parent | a593eda30f82af474887d91458b0e9158f66fefc (diff) | |
download | SMAPI-b6c8cfc28b2c94e6dc3cb07d3058371dd6775e70.tar.gz SMAPI-b6c8cfc28b2c94e6dc3cb07d3058371dd6775e70.tar.bz2 SMAPI-b6c8cfc28b2c94e6dc3cb07d3058371dd6775e70.zip |
simplify 'is not' patterns
Diffstat (limited to 'src/SMAPI/Framework/Content')
-rw-r--r-- | src/SMAPI/Framework/Content/AssetDataForObject.cs | 2 | ||||
-rw-r--r-- | src/SMAPI/Framework/Content/AssetInterceptorChange.cs | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/src/SMAPI/Framework/Content/AssetDataForObject.cs b/src/SMAPI/Framework/Content/AssetDataForObject.cs index d91873ae..40f49190 100644 --- a/src/SMAPI/Framework/Content/AssetDataForObject.cs +++ b/src/SMAPI/Framework/Content/AssetDataForObject.cs @@ -47,7 +47,7 @@ namespace StardewModdingAPI.Framework.Content /// <inheritdoc /> public TData GetData<TData>() { - if (!(this.Data is TData)) + if (this.Data is not TData) throw new InvalidCastException($"The content data of type {this.Data.GetType().FullName} can't be converted to the requested {typeof(TData).FullName}."); return (TData)this.Data; } diff --git a/src/SMAPI/Framework/Content/AssetInterceptorChange.cs b/src/SMAPI/Framework/Content/AssetInterceptorChange.cs index 981eed40..03d6da5a 100644 --- a/src/SMAPI/Framework/Content/AssetInterceptorChange.cs +++ b/src/SMAPI/Framework/Content/AssetInterceptorChange.cs @@ -36,7 +36,7 @@ namespace StardewModdingAPI.Framework.Content this.Instance = instance ?? throw new ArgumentNullException(nameof(instance)); this.WasAdded = wasAdded; - if (!(instance is IAssetEditor) && !(instance is IAssetLoader)) + if (instance is not (IAssetEditor or IAssetLoader)) throw new InvalidCastException($"The provided {nameof(instance)} value must be an {nameof(IAssetEditor)} or {nameof(IAssetLoader)} instance."); } |