Header menu logo 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 : (objnull -> '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 : (objnull -> '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: 'U seq 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: 'U seq

The resulting typed sequence.

RuntimeHelpers.EnumerateThenFinally source compensation

Full Usage: RuntimeHelpers.EnumerateThenFinally source compensation

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

Returns: 'T seq The result sequence.

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

source : 'T seq

The input sequence.

compensation : unit -> unit

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

Returns: 'T seq

The result sequence.

RuntimeHelpers.EnumerateTryWith source exceptionFilter exceptionHandler

Full Usage: RuntimeHelpers.EnumerateTryWith source exceptionFilter exceptionHandler

Parameters:
    source : 'T seq - The input sequence.
    exceptionFilter : exn -> int - Pattern matches after 'when' converted to return 1
    exceptionHandler : exn -> 'T seq - Pattern matches after 'when' with their actual execution code

Returns: 'T seq The result sequence.

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

source : 'T seq

The input sequence.

exceptionFilter : exn -> int

Pattern matches after 'when' converted to return 1

exceptionHandler : exn -> 'T seq

Pattern matches after 'when' with their actual execution code

Returns: 'T seq

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: 'U seq 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: 'U seq

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 : 'T seq - The input sequence.

Returns: 'T seq 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 : 'T seq

The input sequence.

Returns: 'T seq

The result sequence.

Type something to start searching.