Array.isEmpty<'T> Function (F#)
Tests whether an array is empty.
Namespace/Module Path: Microsoft.FSharp.Collections.Array
Assembly: FSharp.Core (in FSharp.Core.dll)
// Signature:
Array.isEmpty : 'T [] -> bool
// Usage:
Array.isEmpty array
Parameters
array
Type: 'T []The input array.
Return Value
true if the array is empty. Otherwise, returns false.
Remarks
This function is named IsEmpty in compiled assemblies. If you are accessing the function from a language other than F#, or through reflection, use this name.
Example
The following code shows how to use Array.isEmpty.
let printArray array1 =
if (Array.isEmpty array1) then
printfn "There are no elements in this array."
else
printfn "This array contains the following elements:"
Array.iter (fun elem -> printf "%A " elem) array1
printfn ""
printArray [| "test1"; "test2" |]
printArray [| |]
Output
This array contains the following elements: "test1" "test2" There are no elements in this array.
Platforms
Windows 7, Windows Vista SP2, Windows XP SP3, Windows XP x64 SP2, Windows Server 2008 R2, Windows Server 2008 SP2, Windows Server 2003 SP2
Version Information
F# Runtime
Supported in: 2.0, 4.0
Silverlight
Supported in: 3