using System; using System.Collections.Generic; namespace NitroxModel.Helper; public static class LinqExtensions { /// /// Returns the items until the predicate stops matching, then includes the next non-matching result as well. /// /// Input enumerable. /// Predicate to match against the items in the enumerable. /// Type of items to return. /// public static IEnumerable TakeUntilInclusive(this IEnumerable source, Func predicate) { foreach (T item in source) { if (predicate(item)) { yield return item; } else { // Also self yield return item; yield break; } } } }