Is IEnumerable Null Or Empty - CSharp System.Collections.Generic

CSharp examples for System.Collections.Generic:IEnumerable

Description

Is IEnumerable Null Or Empty

Demo Code


using System.Threading.Tasks;
using System.Text;
using System.Linq;
using System.Collections.Generic;
using System;/*from   w  ww .ja va  2 s . co  m*/

public class Main{
        public static bool IsNullOrEmpty<T>(this IEnumerable<T> coll)
       {
           return (coll == null || !coll.Any());
       }
}

Related Tutorials