using System.Collections; using System.Diagnostics.CodeAnalysis; namespace PkmnLib.Dynamic.ScriptHandling; /// /// A holder class for a script. This is used so we can cache a list of these, and iterate over them, even when /// the underlying script changes. /// public class ScriptContainer : IEnumerable { /// /// Whether this container is empty. /// [MemberNotNullWhen(false, nameof(ScriptHandling.Script))] public bool IsEmpty => Script is null; /// /// The script in this container. /// public Script? Script { get; set; } = null; /// public IEnumerator GetEnumerator() { yield return this; } IEnumerator IEnumerable.GetEnumerator() { return GetEnumerator(); } }