Share via


Funzione Array.isEmpty<'T> (F#)

Verifica se una matrice è vuota.

Percorso di spazio dei nomi/modulo: Microsoft.FSharp.Collections.Array

Assembly: FSharp.Core (in FSharp.Core.dll)

// Signature:
Array.isEmpty : 'T [] -> bool

// Usage:
Array.isEmpty array

Parametri

  • array
    Tipo: 'T []

    Matrice di input.

Valore restituito

true se la matrice è vuota. In caso contrario, restituisce false.

Note

Questa funzione è denominata IsEmpty negli assembly compilati. Utilizzare questo nome se si accede alla funzione da un linguaggio diverso da F# o tramite reflection.

Esempio

Nel codice riportato di seguito viene illustrato come utilizzare 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

  

Piattaforme

Windows 7, Windows Vista SP2, Windows XP SP3, Windows XP x64 SP2, Windows Server 2008 R2, Windows Server 2008 SP2, Windows Server 2003 SP2.

Informazioni sulla versione

F# Runtime

Supportato in: 2.0, 4.0

Silverlight

Supportato in: 3

Vedere anche

Riferimenti

Modulo Collections.Array (F#)

Spazio dei nomi Microsoft.FSharp.Collections (F#)

Cronologia delle modifiche

Data

Cronologia

Motivo

Agosto 2010

Aggiunto esempio di codice.

Miglioramento delle informazioni.