次の方法で共有


List.isEmpty<'T> 関数 (F#)

更新 : 2010 年 8 月

リストが空であるかどうかをテストします。

名前空間/モジュール パス: Microsoft.FSharp.Collections.List

アセンブリ: FSharp.Core (FSharp.Core.dll)

// Signature:
List.isEmpty : 'T list -> bool

// Usage:
List.isEmpty list

パラメーター

  • list
    型: 'T list

    入力リスト。

戻り値

リストが空の場合は true。 それ以外の場合は、false を返します。

解説

この関数は、コンパイルされたアセンブリでは IsEmpty という名前です。 F# 以外の .NET 言語から、またはリフレクションを使用してこの関数にアクセスする場合は、この名前を使用します。

使用例

List.isEmpty の使用例を次のコードに示します。

let printList list1 = 
    if (List.isEmpty list1) then
        printfn "There are no elements in this list."
    else
        printfn "This list contains the following elements:"
        List.iter (fun elem -> printf "%A " elem) list1
        printfn ""
printList [ "test1"; "test2" ]
printList [ ]

出力

  

プラットフォーム

Windows 7、Windows Vista SP2、Windows XP SP3、Windows XP x64 SP2、Windows Server 2008 R2、Windows Server 2008 SP2、Windows Server 2003 SP2

バージョン情報

F# ランタイム

サポート対象: 2.0、4.0

Silverlight

サポート: 3

参照

その他の技術情報

Collections.List モジュール (F#)

Microsoft.FSharp.Collections 名前空間 (F#)

履歴の変更

日付

履歴

理由

2010 年 8 月

コード例を追加。

情報の拡充