FSharpValue Type
Contains operations associated with constructing and analyzing values associated with F# types such as records, unions and tuples.
Static members
Static member | Description | ||
Full Usage:
FSharpValue.GetExceptionFields(exn, ?bindingFlags)
Parameters:
obj
-
The exception instance.
?bindingFlags : BindingFlags
-
Optional binding flags.
Returns: obj array
The fields from the given exception.
|
Assumes the given input is an F# exception value. If not, ArgumentException is raised.
|
||
Full Usage:
FSharpValue.GetRecordField(record, info)
Parameters:
obj
-
The record object.
info : PropertyInfo
-
The PropertyInfo describing the field to read.
Returns: obj
The field from the record.
|
Assumes the given input is a record value. If not, ArgumentException is raised.
|
||
Full Usage:
FSharpValue.GetRecordFields(record, ?bindingFlags)
Parameters:
obj
-
The record object.
?bindingFlags : BindingFlags
-
Optional binding flags for the record.
Returns: obj array
The array of fields from the record.
|
Assumes the given input is a record value. If not, ArgumentException is raised.
|
||
|
Assumes the given input is a tuple value. If not, ArgumentException is raised.
|
||
|
Assumes the given input is a tuple value. If not, ArgumentException is raised.
|
||
Full Usage:
FSharpValue.GetUnionFields(value, unionType, ?bindingFlags)
Parameters:
obj
-
The input union case.
unionType : Type
-
The union type containing the value.
?bindingFlags : BindingFlags
-
Optional binding flags.
Returns: UnionCaseInfo * obj array
The description of the union case and its fields.
|
Assumes the given input is a union case value. If not, ArgumentException is raised. If the type is not given, then the runtime type of the input object is used to identify the relevant union type. The type should always be given if the input object may be null. For example, option values may be represented using the 'null'.
|
||
|
|||
Full Usage:
FSharpValue.MakeRecord(recordType, values, ?bindingFlags)
Parameters:
Type
-
The type of record to make.
values : obj array
-
The array of values to initialize the record.
?bindingFlags : BindingFlags
-
Optional binding flags for the record.
Returns: obj
The created record.
|
Assumes the given input is a record type.
|
||
|
Assumes at least one element is given. If not, ArgumentException is raised.
|
||
Full Usage:
FSharpValue.MakeUnion(unionCase, args, ?bindingFlags)
Parameters:
UnionCaseInfo
-
The description of the union case to create.
args : obj array
-
The array of arguments to construct the given case.
?bindingFlags : BindingFlags
-
Optional binding flags.
Returns: obj
The constructed union case.
|
|
||
Full Usage:
FSharpValue.PreComputeRecordConstructor(recordType, ?bindingFlags)
Parameters:
Type
-
The type of record to construct.
?bindingFlags : BindingFlags
-
Optional binding flags.
Returns: obj array -> obj
A function to construct records of the given type.
|
Assumes the given type is a RecordType. If not, ArgumentException is raised during pre-computation.
|
||
Full Usage:
FSharpValue.PreComputeRecordConstructorInfo(recordType, ?bindingFlags)
Parameters:
Type
-
The record type.
?bindingFlags : BindingFlags
-
Optional binding flags.
Returns: ConstructorInfo
A ConstructorInfo for the given record type.
|
|
||
Full Usage:
FSharpValue.PreComputeRecordFieldReader(info)
Parameters:
PropertyInfo
-
The PropertyInfo of the field to read.
Returns: obj -> obj
A function to read the specified field from the record.
|
Precompute a function for reading a particular field from a record. Assumes the given type is a RecordType with a field of the given name. If not, ArgumentException is raised during pre-computation. Using the computed function will typically be faster than executing a corresponding call to Value.GetInfo because the path executed by the computed function is optimized given the knowledge that it will be used to read values of the given type.
|
||
Full Usage:
FSharpValue.PreComputeRecordReader(recordType, ?bindingFlags)
Parameters:
Type
-
The type of record to read.
?bindingFlags : BindingFlags
-
Optional binding flags.
Returns: obj -> obj array
An optimized reader for the given record type.
|
Assumes the given type is a RecordType. If not, ArgumentException is raised during pre-computation. Using the computed function will typically be faster than executing a corresponding call to Value.GetInfo because the path executed by the computed function is optimized given the knowledge that it will be used to read values of the given type.
|
||
|
Assumes the given type is a TupleType. If not, ArgumentException is raised during pre-computation.
|
||
Full Usage:
FSharpValue.PreComputeTupleConstructorInfo(tupleType)
Parameters:
Type
-
The input tuple type.
Returns: ConstructorInfo * Type option
The description of the tuple type constructor and an optional extra type
for large tuples.
|
For large tuples, an additional type is returned indicating that a nested encoding has been used for the tuple type. In this case the suffix portion of the tuple type has the given type and an object of this type must be created and passed as the last argument to the ConstructorInfo. A recursive call to PreComputeTupleConstructorInfo can be used to determine the constructor for that the suffix type.
|
||
Full Usage:
FSharpValue.PreComputeTuplePropertyInfo(tupleType, index)
Parameters: Returns: PropertyInfo * (Type * int) option
The description of the tuple element and an optional type and index if the tuple is big.
|
|||
|
Assumes the given type is a TupleType. If not, ArgumentException is raised during pre-computation.
|
||
Full Usage:
FSharpValue.PreComputeUnionConstructor(unionCase, ?bindingFlags)
Parameters:
UnionCaseInfo
-
The description of the union case.
?bindingFlags : BindingFlags
-
Optional binding flags.
Returns: obj array -> obj
A function for constructing values of the given union case.
|
|
||
Full Usage:
FSharpValue.PreComputeUnionConstructorInfo(unionCase, ?bindingFlags)
Parameters:
UnionCaseInfo
-
The description of the union case.
?bindingFlags : BindingFlags
-
Optional binding flags.
Returns: MethodInfo
The description of the constructor of the given union case.
|
|
||
Full Usage:
FSharpValue.PreComputeUnionReader(unionCase, ?bindingFlags)
Parameters:
UnionCaseInfo
-
The description of the union case to read.
?bindingFlags : BindingFlags
-
Optional binding flags.
Returns: obj -> obj array
A function to for reading the fields of the given union case.
|
Using the computed function will typically be faster than executing a corresponding call to GetFields
|
||
Full Usage:
FSharpValue.PreComputeUnionTagMemberInfo(unionType, ?bindingFlags)
Parameters:
Type
-
The type of union to read.
?bindingFlags : BindingFlags
-
Optional binding flags.
Returns: MemberInfo
The description of the union case reader.
|
|
||
Full Usage:
FSharpValue.PreComputeUnionTagReader(unionType, ?bindingFlags)
Parameters:
Type
-
The type of union to optimize reading.
?bindingFlags : BindingFlags
-
Optional binding flags.
Returns: obj -> int
An optimized function to read the tags of the given union type.
|
Using the computed function is more efficient than calling GetUnionCase because the path executed by the computed function is optimized given the knowledge that it will be used to read values of the given type.
|