diff options
author | Jesse Plamondon-Willard <Pathoschild@users.noreply.github.com> | 2022-04-13 21:07:43 -0400 |
---|---|---|
committer | Jesse Plamondon-Willard <Pathoschild@users.noreply.github.com> | 2022-04-13 21:07:43 -0400 |
commit | 4adf8611131a5d86b15f017a42a0366837d14528 (patch) | |
tree | 879ba8dfc546382c3795e3d13a623b0e17f96469 /src/SMAPI/Framework/Reflection/CacheEntry.cs | |
parent | 5b24fff4771dd11c627ae20c827599fe37fa89ad (diff) | |
download | SMAPI-4adf8611131a5d86b15f017a42a0366837d14528.tar.gz SMAPI-4adf8611131a5d86b15f017a42a0366837d14528.tar.bz2 SMAPI-4adf8611131a5d86b15f017a42a0366837d14528.zip |
enable nullable annotations in the rest of SMAPI core (#837)
Diffstat (limited to 'src/SMAPI/Framework/Reflection/CacheEntry.cs')
-rw-r--r-- | src/SMAPI/Framework/Reflection/CacheEntry.cs | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/src/SMAPI/Framework/Reflection/CacheEntry.cs b/src/SMAPI/Framework/Reflection/CacheEntry.cs index 6b18d204..27f48a1f 100644 --- a/src/SMAPI/Framework/Reflection/CacheEntry.cs +++ b/src/SMAPI/Framework/Reflection/CacheEntry.cs @@ -1,5 +1,4 @@ -#nullable disable - +using System.Diagnostics.CodeAnalysis; using System.Reflection; namespace StardewModdingAPI.Framework.Reflection @@ -11,21 +10,20 @@ namespace StardewModdingAPI.Framework.Reflection ** Accessors *********/ /// <summary>Whether the lookup found a valid match.</summary> - public bool IsValid { get; } + [MemberNotNullWhen(true, nameof(CacheEntry.MemberInfo))] + public bool IsValid => this.MemberInfo != null; /// <summary>The reflection data for this member (or <c>null</c> if invalid).</summary> - public MemberInfo MemberInfo { get; } + public MemberInfo? MemberInfo { get; } /********* ** Public methods *********/ /// <summary>Construct an instance.</summary> - /// <param name="isValid">Whether the lookup found a valid match.</param> /// <param name="memberInfo">The reflection data for this member (or <c>null</c> if invalid).</param> - public CacheEntry(bool isValid, MemberInfo memberInfo) + public CacheEntry(MemberInfo? memberInfo) { - this.IsValid = isValid; this.MemberInfo = memberInfo; } } |