Lazy.Create<'T> 拡張メソッド (F#)
更新 : 2010 年 5 月
強制されたときに指定された関数の結果と評価される遅延計算を作成します。
名前空間/モジュール パス: Microsoft.FSharp.Control.LazyExtensions
アセンブリ: FSharp.Core (FSharp.Core.dll 内)
// Signature:
type System.Lazy with
member static Create : Lazy<'T>
// Usage:
lazy.Create (creator)
パラメーター
creator
型: unit -> 'T必要に応じて値を提供する関数。
戻り値
作成された遅延オブジェクト。
使用例
次のコードは、Create の使用例です。
let lazyValue n = Lazy.Create (fun () ->
let rec factorial n =
match n with
| 0 | 1 -> 1
| n -> n * factorial (n - 1)
factorial n)
let lazyVal = lazyValue 10
printfn "%d" (lazyVal.Force())
出力は 10 の階乗になります。
プラットフォーム
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
Silverlight
サポート: 3
参照
参照
その他の技術情報
Control.LazyExtensions モジュール (F#)
履歴の変更
日付 |
履歴 |
理由 |
---|---|---|
2010 年 5 月 |
コード例を追加。 |
情報の拡充 |