keyof<'T> Type
Get a property key from a mapping function for the given type.
Example
type Book<'T> = { Title: keyof<'T> }
type LibraryHires = {
Witcher: int
Dune: int
}
let makeBook (key: keyof<LibraryHires>): Book<LibraryHires> = {
Title = key
}
let dune = makeBook (keyof<_> _.Dune)
dune.Title.Value // "Dune"
type Book<'T> =
{ Title: obj }
'T
type LibraryHires =
{
Witcher: int
Dune: int
}
Multiple items
val int: value: 'T -> int (requires member op_Explicit)
--------------------
type int = int32
--------------------
type int<'Measure> = int
val int: value: 'T -> int (requires member op_Explicit)
--------------------
type int = int32
--------------------
type int<'Measure> = int
val makeBook: key: 'a -> Book<LibraryHires>
val key: 'a
val dune: Book<LibraryHires>
Book.Title: obj
Instance members
| Instance member |
Description
|
Full Usage:
this.Invoke
Parameters:
'T
Returns: obj option
Modifiers: inline |
|
Full Usage:
this.Value
Returns: string
Modifiers: inline |
|
Static members
| Static member |
Description
|
Full Usage:
keyof.Access(accessedObject, key)
Parameters:
'T
key : keyof<'T>
Returns: obj option
Modifiers: inline |
|
Full Usage:
keyof.UnsafeAccess(accessedObject, key)
Parameters:
obj
key : keyof<'a>
Returns: obj option
Modifiers: inline |
|
|
|
|
|
|