Determines whether all elements of a sequence are set to the default value of . - CSharp System

CSharp examples for System:Array Element

Description

Determines whether all elements of a sequence are set to the default value of .

Demo Code


using System.Linq;
using System;//w ww  .  ja  v  a  2 s .  c om

public class Main{
        /// <summary>
        /// Determines whether all elements of a sequence are set to the default value of <see cref="T"/>.
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="array"></param>
        /// <returns></returns>
        public static bool AllDefault<T>(this Array array)
        {
            return array.Cast<T>().AllDefault();
        }
}

Related Tutorials