Created
June 20, 2015 12:48
-
-
Save aivascu/305fe85be9de847c23f6 to your computer and use it in GitHub Desktop.
LINQ independent IsNullOrEmpty extension class
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Collections; | |
using System.Collections.Generic; | |
namespace Demo.Utility | |
{ | |
public static class IsNullOrEmptyExtension | |
{ | |
public static bool IsNullOrEmpty(this IEnumerable source) | |
{ | |
if (source != null) | |
{ | |
foreach (object obj in source) | |
{ | |
return false; | |
} | |
} | |
return true; | |
} | |
public static bool IsNullOrEmpty<T>(this IEnumerable<T> source) | |
{ | |
if (source != null) | |
{ | |
foreach (T obj in source) | |
{ | |
return false; | |
} | |
} | |
return true; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment