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

CSharp examples for System:Array Null Element

Description

Determines if an array is not null or empty.

Demo Code

//     Copyright (C) 2009-2015 Typesafe Inc. <http://www.typesafe.com>
using System.Linq;
using System.Collections.Generic;
using System;/*  ww w  . j ava2s .c om*/

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

Related Tutorials