BITKit/Packages/Core/Extensions/Linq.cs

17 lines
458 B
C#
Raw Normal View History

2023-06-05 19:57:17 +08:00
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BITKit
{
public static partial class Extensions
{
public static IEnumerable<TResult> SelectWhere<TSource, TResult>(this IEnumerable<TSource> source, Func<TSource, TResult> selector)
{
return source.Where(x => selector.Invoke(x) is not null).Select(x => selector.Invoke(x));
}
}
}