ExtensionMethod.NET Home of 877 C#, Visual Basic, F# and Javascript extension methods

IsNullOrEmpty

Indicates whether the specified array is null or empty (has no items). Returns true if the array parameter is null or empty; otherwise, false.

Source

public static bool IsNullOrEmpty(this Array array)
{
   return array == null || array.Length == 0;
}

Example

var array = new string[]{};
var isEmpty= array.IsNullOrEmpty();

Author: jepozdemir

Submitted on: 21 nov. 2023

Language: csharp

Type: System.Array

Views: 1280