Is the provided collection null or empty? - CSharp System.Collections.Generic

CSharp examples for System.Collections.Generic:ICollection

Description

Is the provided collection null or empty?

Demo Code


using System.Linq;
using System;//from  w  w w .  jav a2  s .  c  o  m
using System.Collections.Generic;
using System.Collections;
using UnityEngine;

public class Main{
        /// <summary>
        /// Is the provided collection null or empty? 
        /// </summary>
        public static bool IsNullOrEmpty(this ICollection self)
        {
            return self == null || self.Count == 0;
        }
}

Related Tutorials