Checks whether this enumerable is empty. - CSharp System

CSharp examples for System:Enum

Description

Checks whether this enumerable is empty.

Demo Code


using System.Text;
using System.Collections.Generic;
using System;/*from  ww  w.  j  ava2 s.  c  o m*/

public class Main{
        /// <summary>
        /// Checks whether this enumerable is empty.
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="src"></param>
        public static bool IsEmpty<T>(this IEnumerable<T> src)
        {
            foreach (var item in src) return false;
            return true;
        }
}

Related Tutorials