add WhereNotNull
This commit is contained in:
parent
d4cef72fd2
commit
d12750e1c4
@ -9,8 +9,10 @@
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netstandard2.0</TargetFramework>
|
||||
<Description>A bunch of common extensions</Description>
|
||||
<Description>A set of common utilities and extension methods for .NET.</Description>
|
||||
<LangVersion>7.3</LangVersion>
|
||||
<Version>21.4.20.1</Version>
|
||||
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
@ -255,6 +255,17 @@ namespace BinaryDad.Extensions
|
||||
return list;
|
||||
}
|
||||
|
||||
public static IEnumerable<T> WhereNotNull<T>(this IEnumerable<T> list)
|
||||
{
|
||||
foreach (var item in list)
|
||||
{
|
||||
if (item != null)
|
||||
{
|
||||
yield return item;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ForEach
|
||||
|
Loading…
x
Reference in New Issue
Block a user