Reflection.FSharpReflectionExtensions Module (F#)

Visual Studio 2013

A module of extension members that provides versions of certain F# reflection APIs for use with the .NET portable library.

Namespace/Module Path: Microsoft.FSharp.Reflection.FSharpReflectionExtensions

Assembly: FSharp.Core (in FSharp.Core.dll)

module FSharpReflectionExtensions =

  type FSharpType with
    static member GetExceptionFields : Type * ?bool -> PropertyInfo []
    static member GetRecordFields : Type * ?bool -> PropertyInfo []
    static member GetUnionCases : Type * ?bool -> UnionCaseInfo []
    static member IsExceptionRepresentation : Type * ?bool -> bool
    static member IsRecord : Type * ?bool -> bool
    static member IsUnion : Type * ?bool -> bool

  type FSharpValue with
    static member GetExceptionFields : obj * ?bool -> obj []
    static member GetRecordFields : obj * ?bool -> obj []
    static member GetUnionFields : obj * Type * ?bool -> UnionCaseInfo * obj []
    static member MakeRecord : Type * obj [] * ?bool -> obj
    static member MakeUnion : UnionCaseInfo * obj [] * ?bool -> obj
    static member PreComputeRecordConstructor : Type * ?bool -> obj [] -> obj
    static member PreComputeRecordConstructorInfo : Type * ?bool -> ConstructorInfo
    static member PreComputeRecordFieldReader : PropertyInfo -> obj -> obj
    static member PreComputeRecordReader : Type * ?bool -> obj -> obj []
    static member PreComputeUnionConstructor : UnionCaseInfo * ?bool -> obj [] -> obj
    static member PreComputeUnionConstructorInfo : UnionCaseInfo * ?bool -> MethodInfo
    static member PreComputeUnionReader : UnionCaseInfo * ?bool -> obj -> obj []
    static member PreComputeUnionTagMemberInfo : Type * ?bool -> MemberInfo
    static member PreComputeUnionTagReader : Type * ?bool -> obj -> int

The .NET portable library does not have the BindingFlags type, so these methods provide alternative versions of certain methods on the FSharpType and FSharpValue types that take a bool as a parameter instead of BindingFlags. For other methods, use the FSharpType and FSharpValue types directly.

Extension Member

Description

FSharpType.GetExceptionFields

Reads all the fields from an F# exception declaration, in declaration order.

FSharpType.GetRecordFields

Reads all the fields from a record value, in declaration order.

FSharpType.GetUnionCases

Gets the cases of a union type.

FSharpType.IsExceptionRepresentation

Returns true if the given type is a representation of an F# exception declaration.

FSharpType.IsRecord

Returns true if the type is a representation of an F# record type.

FSharpType.IsUnion

Returns true if the given type is a representation of an F# union type or the runtime type of a value of that type.

FSharpValue.GetExceptionFields

Reads all the fields from a value built using an instance of an F# exception declaration.

FSharpValue.GetRecordFields

Reads all the fields from a record value.

FSharpValue.GetUnionFields

Identify the union case and its fields for an object.

FSharpValue.MakeRecord

Creates an instance of a record type.

FSharpValue.MakeUnion

Create a union case value.

FSharpValue.PreComputeRecordConstructor

Precompute a function for constructing a record value.

FSharpValue.PreComputeRecordConstructorInfo

Get a ConstructorInfo for a record type.

FSharpValue.PreComputeRecordReader

Precompute a function for reading all the fields from a record. The fields are returned in the same order as the fields reported by a call to Microsoft.FSharp.Reflection.Type.GetInfo for this type.

FSharpValue.PreComputeUnionConstructor

Precomputes a function for constructing a discriminated union value for a particular union case.

FSharpValue.PreComputeUnionConstructorInfo

A method that constructs objects of the given case.

FSharpValue.PreComputeUnionReader

Precomputes a function for reading all the fields for a particular discriminator case of a union type.

FSharpValue.PreComputeUnionTagMemberInfoFSharpValue.PreComputeUnionTagMemberInfo

Precompute a property or static method for reading an integer representing the case tag of a union type.

FSharpValue.PreComputeUnionTagReader

Precompute an optimized function to read the tags of the given union type.

Windows 8, Windows 7, Windows Server 2012, Windows Server 2008 R2

F# Core Library Versions

Supported in: 2.0, 4.0, Portable

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft