FSharp.Core


RuntimeHelpers Module

A group of functions used as part of the compiled representation of F# sequence expressions.

Functions and values

Function or value Description

RuntimeHelpers.CreateEvent addHandler removeHandler createHandler

Full Usage: RuntimeHelpers.CreateEvent addHandler removeHandler createHandler

Parameters:
    addHandler : 'Delegate -> unit - A function to handle adding a delegate for the event to trigger.
    removeHandler : 'Delegate -> unit - A function to handle removing a delegate that the event triggers.
    createHandler : (obj -> 'Args -> unit) -> 'Delegate - A function to produce the delegate type the event can trigger.

Returns: IEvent<'Delegate, 'Args> The initialized event.

Creates an anonymous event with the given handlers.

addHandler : 'Delegate -> unit

A function to handle adding a delegate for the event to trigger.

removeHandler : 'Delegate -> unit

A function to handle removing a delegate that the event triggers.

createHandler : (obj -> 'Args -> unit) -> 'Delegate

A function to produce the delegate type the event can trigger.

Returns: IEvent<'Delegate, 'Args>

The initialized event.

RuntimeHelpers.EnumerateFromFunctions create moveNext current

Full Usage: RuntimeHelpers.EnumerateFromFunctions create moveNext current

Parameters:
    create : unit -> 'T - An initializer function.
    moveNext : 'T -> bool - A function to iterate and test if end of sequence is reached.
    current : 'T -> 'U - A function to retrieve the current element.

Returns: seq<'U> The resulting typed sequence.

The F# compiler emits calls to this function to implement the compiler-intrinsic conversions from untyped IEnumerable sequences to typed sequences.

create : unit -> 'T

An initializer function.

moveNext : 'T -> bool

A function to iterate and test if end of sequence is reached.

current : 'T -> 'U

A function to retrieve the current element.

Returns: seq<'U>

The resulting typed sequence.

RuntimeHelpers.EnumerateThenFinally source compensation

Full Usage: RuntimeHelpers.EnumerateThenFinally source compensation

Parameters:
    source : seq<'T> - The input sequence.
    compensation : unit -> unit - A computation to be included in an enumerator's Dispose method.

Returns: seq<'T> The result sequence.

The F# compiler emits calls to this function to implement the try/finally operator for F# sequence expressions.

source : seq<'T>

The input sequence.

compensation : unit -> unit

A computation to be included in an enumerator's Dispose method.

Returns: seq<'T>

The result sequence.

RuntimeHelpers.EnumerateUsing resource source

Full Usage: RuntimeHelpers.EnumerateUsing resource source

Parameters:
    resource : 'T - The resource to be used and disposed.
    source : 'T -> 'Collection - The input sequence.

Returns: seq<'U> The result sequence.

The F# compiler emits calls to this function to implement the use operator for F# sequence expressions.

resource : 'T

The resource to be used and disposed.

source : 'T -> 'Collection

The input sequence.

Returns: seq<'U>

The result sequence.

RuntimeHelpers.EnumerateWhile guard source

Full Usage: RuntimeHelpers.EnumerateWhile guard source

Parameters:
    guard : unit -> bool - A function that indicates whether iteration should continue.
    source : seq<'T> - The input sequence.

Returns: seq<'T> The result sequence.

The F# compiler emits calls to this function to implement the while operator for F# sequence expressions.

guard : unit -> bool

A function that indicates whether iteration should continue.

source : seq<'T>

The input sequence.

Returns: seq<'T>

The result sequence.