Extensions.Is |
Determines whether is null or empty.
Namespace: Gamanet.C4.SimpleInterfaces
Assembly: Gamanet.C4.SimpleInterfaces (in Gamanet.C4.SimpleInterfaces.dll) Version: 2026.0.0.242
Syntax
C#
public static bool IsNullOrEmpty<T>( this IEnumerable<T> collection )
Parameters
- collection IEnumerable<T>
- The collection.
Type Parameters
- T
- collection
Return Value
Booleantrue if [is null or empty] [the specified collection]; otherwise, false.
Usage Note
In Visual Basic and C#, you can call this method as an instance method on any object of type IEnumerable<T>. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).Example
The following example illustrates how to check if string null or empty
C#
using System; using System.Collections.Generic; using Gamanet.C4.SimpleInterfaces; public static class IsNullOrEmptyString { static void Main() { void WriteResult(bool b) { if (b) // if true { Console.WriteLine("Object null or empty"); } else { Console.WriteLine("Object not null or empty"); } } WriteResult("".IsNullOrEmpty()); WriteResult("ABC".IsNullOrEmpty()); // The example displays the following output: Object null or empty Object not null or empty } }
See Also