Partager via


Array.empty<'T>, fonction de type (F#)

Retourne un tableau vide du type donné.

Espace de noms/Chemin du module : Microsoft.FSharp.Collections.Array

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

// Signature:
Array.empty<'T> :  'T []

// Usage:
Array.empty

Valeur de retour

Tableau vide.

Notes

Cette fonction se nomme Empty dans les assemblys compilés.Si vous accédez à la fonction à partir d'un langage .NET autre que F# ou par réflexion, utilisez ce nom.

Exemple

Le code suivant montre comment utiliser Array.empty :

// Specify the type by using a type argument.
let array1 = Array.empty<int>
// Specify the type by using a type annotation.
let array2 : int array = Array.empty

// Even though array3 has a generic type,
// you can still use methods such as Length on it.
let array3 = Array.empty
printfn "Length of empty array: %d" array3.Length

Sortie

  

Plateformes

Windows 8, Windows 7, Windows Server 2012, Windows Server 2008 R2

Informations de version

Versions de bibliothèque principale F#

Prise en charge dans : 2,0, 4,0, portables

Voir aussi

Référence

Collections.Array, module (F#)

Microsoft.FSharp.Collections, espace de noms (F#)