[Home] Module Microsoft.FSharp.Idioms


Types

TypeDescription
type EventListeners This type implements a container to hold a set of listeners plus an action to 'fire' the event to all listeners. Note you are free to implement alternative containers to hold listener sets in more efficient ways, as long as you publish the listener set as a property through an Idioms.IEvent object.
type Handler Fresh events declared in F# are typically values of type Idioms.IHandlerEvent<'a>. These hold event handlers of type Idioms.Handler<'a>.
type IDelegateEvent This type lets F# code declare .NET events over any .NET delegate type. For example, Idioms.DelegateEvent<PaintEventHandler,(obj * PaintEventArgs)> can be used for an event whose callbacks are of type PaintEventHandler. The delegate and argument types must match.
type IEvent
type IHandlerEvent This type gives an easy way to declare events, simply by declaring an instance property of type Idioms.IEvent<ty> for some argument type. These events hold handlers of type Idioms.Handler<ty>. F# gives special status to non-virtual instance member properties of type Idioms.IEvent, generating approriate .NET metadata to make the member appear to other .NET languages as a .NET event. Note: an abbreviation for IDelegateEvent ,'a>
type sizeof
type typ

Values

ValueDescription
val box : 'a -> obj
Convert a value to the univeral representation type 'obj', where the argument type is inferred from context.
val foreach : #IEnumerable -> ('a -> unit) -> unit
This idiom corresponds to the C# "foreach" construct. Use as: 'foreach (collection) (fun (x:expectedType) -> ...)'. Try using 'Idioms.foreachG' before using this function, as that detects if the collection supports a typesafe IEnumerable<T>. If any element of the heterogeneous collection does not have the given type then a runtime error will be raised. Not all F# collection types directly implement the required interfaces, hence you may need to call a projection function such as 'CollectionType.to_IEnumerable'.
val foreachG : #IEnumerable<'a> -> ('a -> unit) -> unit
Enumerator iteration. See 'foreach'.
val lock : 'b -> (unit -> 'a) -> 'a
The idiom corresponding to the C# "lock(x) { ... }" construct. Use as: lock (x) (fun () -> ...)
val ParamArray : 'a list -> 'a []
Use when calling a method from another .NET language that expects a variable number of arguments.
val sizeof : unit -> 'a sizeof
Return a sizeof value containing an integer representing the runtime allocated size of handles to values of a given F# type. Most F# types will have a handle size of 1 native machine word.
val typeof : unit -> 'a typ
Generate a 'typ' value containing a System.Type runtime represenation of an F# type. The static type is still maintained on the value returned.
val unbox : obj -> 'a
Convert a value from the univeral representation type 'obj' to another type, where the result type is inferred from context.
val using : 'a -> ('a -> 'b) -> 'b when 'a :> IDisposable
The idiom corresponding to the C# "using" construct, which uses the IDisposable interface to dispose of a native resource even when an exception is raised by the protected code. Use as: using (myResource) (fun () -> ... )

Deprecated Values

ValueDescription
val CombineEnumFlags : 'a list -> 'a when 'a :> Enum

Deprecated: This member is deprecated. Use Enum.combine instead

Combine enum values using 'logical or'. The relevant enumeration type is inferred from context.
val EnumToInt : #Enum -> int

Deprecated: This member is deprecated. Use Enum.to_int instead

Convert an enumeration value to an integer. The argument type is inferred from context.
val foldeach : #IEnumerable -> 'acc -> ('acc -> 'a -> 'acc) -> 'acc

Deprecated: This member is deprecated. Use "x |> IEnumerable.untyped_fold" instead.

val foldeachE : #IEnumerator -> 'acc -> ('acc -> 'a -> 'acc) -> 'acc

Deprecated: This member is deprecated.

val foldeachEG : #IEnumerator<'a> -> 'acc -> ('acc -> 'a -> 'acc) -> 'acc

Deprecated: This member is deprecated.

val foldeachG : #IEnumerable<'a> -> 'acc -> ('acc -> 'a -> 'acc) -> 'acc

Deprecated: This member is deprecated. Use "x |> IEnumerable.fold" instead.

val foreachE : #IEnumerator -> ('a -> unit) -> unit

Deprecated: This member is deprecated.

val foreachEG : #IEnumerator<'a> -> ('a -> unit) -> unit

Deprecated: This member is deprecated.

val IntToEnum : int -> #Enum

Deprecated: This member is deprecated. Use Enum.of_int instead

Convert an integer to an enumeration value. The result type is inferred from context.
val TestEnumFlag : 'a -> 'a -> bool when 'a :> Enum

Deprecated: This member is deprecated. Use Enum.test instead

Test if an enumeration value has a particular flag set, using 'logical and'. The relevant enumeration type is inferred from context.
val transform : #IEnumerable -> ('a -> 'b) -> IEnumerable

Deprecated: This member is deprecated. Use "x |> IEnumerable.untyped_map" instead.

val transformE : #IEnumerator -> ('a -> 'b) -> IEnumerator

Deprecated: This member is deprecated.

val transformEG : #IEnumerator<'a> -> ('a -> 'b) -> IEnumerator<'b>

Deprecated: This member is deprecated.

val transformG : #IEnumerable<'a> -> ('a -> 'b) -> IEnumerable<'b>

Deprecated: This member is deprecated. Use "x |> IEnumerable.map" instead.

See Also

Microsoft.FSharp


Documentation for assembly fslib, version 1.1.10.1, generated using F# version 1.1.10.1