using System.Diagnostics.CodeAnalysis;
using System.Reflection;
namespace StardewModdingAPI.Framework.Reflection
{
/// A cached member reflection result.
internal readonly struct CacheEntry
{
/*********
** Accessors
*********/
/// Whether the lookup found a valid match.
[MemberNotNullWhen(true, nameof(CacheEntry.MemberInfo))]
public bool IsValid => this.MemberInfo != null;
/// The reflection data for this member (or null if invalid).
public MemberInfo? MemberInfo { get; }
/*********
** Public methods
*********/
/// Construct an instance.
/// The reflection data for this member (or null if invalid).
public CacheEntry(MemberInfo? memberInfo)
{
this.MemberInfo = memberInfo;
}
}
}