Enum Module
Parsing and bitwise flag helpers for enums, generic over any enum type via
Functions and values
| Function or value |
Description
|
Full Usage:
Enum.addFlagWhen condition flag value
Parameters:
bool
-
Whether to add the flag.
flag : EnumShape<EnumShape<^a>>
-
The flag(s) to add.
value : EnumShape<^a>
-
The value to conditionally add the flag(s) to.
Returns: EnumShape<EnumShape<^a>>
Modifiers: inline Type parameters: ^a |
Adds flag to value only when condition is
Example
|
|
Returns
Example
[<Struct>]
type Permissions =
| None = 0
| Read = 1
| Write = 2
| Execute = 4
union case Option.None: Option<'T>
Permissions.Read: Permissions = 1
Permissions.Write: Permissions = 2
Permissions.Execute: Permissions = 4
|
Full Usage:
Enum.removeFlagWhen condition flag value
Parameters:
bool
-
Whether to remove the flag.
flag : EnumShape<EnumShape<^a>>
-
The flag(s) to remove.
value : EnumShape<^a>
-
The value to conditionally remove the flag(s) from.
Returns: EnumShape<EnumShape<^a>>
Modifiers: inline Type parameters: ^a |
Removes flag from value only when condition is
Example
|
Full Usage:
Enum.tryParse str
Parameters:
string
Returns: 'T option
Modifiers: inline Type parameters: 'T |
Parses a string as a case of the enum
|
Full Usage:
Enum.tryParseIgnoreCase str
Parameters:
string
Returns: 'T option
Modifiers: inline Type parameters: 'T |
Parses a string as a case of the enum
|
Full Usage:
Enum.tryParseV str
Parameters:
string
Returns: 'T voption
Modifiers: inline Type parameters: 'T |
Parses a string as a case of the enum
|
Full Usage:
Enum.tryParseVIgnoreCase str
Parameters:
string
Returns: 'T voption
Modifiers: inline Type parameters: 'T |
Parses a string as a case of the enum
|
TDesu.FSharp