Extensions.IsNullOrEmpty<T>(ICollection<T>) Method

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 ICollection<T> collection
)

Parameters

collection  ICollection<T>
The collection.

Type Parameters

T
The type

Return Value

Boolean
true 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 ICollection<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 collction null or empty
C#
using System;
using System.Collections.Generic;
using Gamanet.C4.SimpleInterfaces;

public static class IsNullOrEmptyCollection
 {
     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(new Dictionary<string, object>().IsNullOrEmpty());
         WriteResult(new Dictionary<string, object> { { "", new object() } }.IsNullOrEmpty());

         // The example displays the following output:
         Object null or empty
         Object not null or empty
     }
 }
See Also

Reference

Extensions Class
IsNullOrEmpty Overload
Gamanet.C4.SimpleInterfaces Namespace