AsyncBuilder.For<'T> Method (F#)
Implements the for expression in asynchronous computations. Creates an asynchronous computation that enumerates the sequence on demand and runs a function representing the body of a for expression for each element.
Namespace/Module Path: Microsoft.FSharp.Control
Assembly: FSharp.Core (in FSharp.Core.dll)
// Signature:
member this.For : seq<'T> * ('T -> Async<unit>) -> Async<unit>
// Usage:
asyncBuilder.For (sequence, body)
Parameters
sequence
Type: seq<'T>The sequence to enumerate.
-
A function to take an item from the sequence and create an asynchronous computation. Can be seen as the body of the for expression.
Return Value
An asynchronous computation that will enumerate the sequence and run body for each element.
Remarks
A cancellation check is performed on each iteration of the loop. The existence of this method permits the use of for in the async { ... } computation expression syntax.
Platforms
Windows 7, Windows Vista SP2, Windows XP SP3, Windows XP x64 SP2, Windows Server 2008 R2, Windows Server 2008 SP2, Windows Server 2003 SP2
Version Information
F# Runtime
Supported in: 2.0, 4.0
Silverlight
Supported in: 3