Hinweis
Für den Zugriff auf diese Seite ist eine Autorisierung erforderlich. Sie können versuchen, sich anzumelden oder das Verzeichnis zu wechseln.
Für den Zugriff auf diese Seite ist eine Autorisierung erforderlich. Sie können versuchen, das Verzeichnis zu wechseln.
Creates a lazy computation that evaluates to the result of the given function when forced.
Namespace/Module Path: Microsoft.FSharp.Control.LazyExtensions
Assembly: FSharp.Core (in FSharp.Core.dll)
// Signature:
type System.Lazy with
member static Create : Lazy<'T>
// Usage:
lazy.Create (creator)
Parameters
creator
Type: unit -> 'TThe function to provide the value when needed.
Return Value
The created Lazy object.
Example
The following code illustrates the use of 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())
The output is the factorial of 10.
3628800
Platforms
Windows 8, Windows 7, Windows Server 2012, Windows Server 2008 R2
Version Information
F# Core Library Versions
Supported in: 2.0