Determines if an array is null or empty. - CSharp System

CSharp examples for System:Array Null Element

Description

Determines if an array is null or empty.

Demo Code

//     Copyright (C) 2009-2015 Typesafe Inc. <http://www.typesafe.com>
using System.Linq;
using System.Collections.Generic;
using System;// w  w  w .j a v a  2 s  .co  m

public class Main{
        /// <summary>
        /// Determines if an array is null or empty.
        /// </summary>
        /// <param name="obj">The array to check.</param>
        /// <returns>True if null or empty, false otherwise.</returns>
        public static bool IsNullOrEmpty(this Array obj)
        {
            return ((obj == null) || (obj.Length == 0));
        }
}

Related Tutorials