using System; using System.Collections.Generic; using System.Linq; namespace TwitchDownloaderCore.Extensions { public static class LinqExtensions { public static IEnumerable WhereOnlyIf(this IEnumerable enumerable, Func predicate, bool shouldFilter) { if (shouldFilter) { return enumerable.Where(predicate); } return enumerable; } } }