Skip to content

Commit

Permalink
Add an extension method to remove null items from a collection.
Browse files Browse the repository at this point in the history
  • Loading branch information
Tkael committed Jan 18, 2025
1 parent 89d6dfd commit 2b45450
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions Utilities/ExtensionMethods.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,19 @@
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using System.Collections.Generic;
using System.Linq;
using Utilities;

namespace System
{
public static class IEnumerableExtensions
{
public static IEnumerable<T> RemoveNulls<T> ( this IEnumerable<T> items )
{
return items.Where( i => i != null );
}
}

public static class JTokenExtensions
{
public static bool IsNullOrEmpty(this JToken token)
Expand Down

0 comments on commit 2b45450

Please sign in to comment.