IsNotNullOrEmpty

It returns false if given collection is null or empty otherwise it returns true.

源代码:

1
2
3
4
public static bool IsNotNullOrEmpty(this System.Collections.Generic.IEnumerable<T> source)
{
return source != null && source.Any();
}

示例:

1
2
3
4
5
6
7
8
9
var list = new List<string>();
Assert.IsFalse( list.IsNotNullOrEmpty());


List<string> list = null;
Assert.IsFalse( list.IsFalseNullOrEmpty());

var list = new[] {"One, Two"};
Assert.IsTrue( list.IsNotNullOrEmpty());
Your browser is out-of-date!

Update your browser to view this website correctly. Update my browser now

×