Header menu logo FSharp.Core

Operators Module

Basic F# Operators. This module is automatically opened in all F# code.

Nested modules

Modules Description

ArrayExtensions

Contains extension methods to allow the use of F# indexer notation with arrays.
 This module is automatically opened in all F# code.

Checked

This module contains the basic arithmetic operations with overflow checks.

NonStructuralComparison

A module of comparison and equality operators that are statically resolved, but which are not fully generic and do not make structural comparison. Opening this
 module may make code that relies on structural or generic comparison no longer compile.

OperatorIntrinsics

A module of compiler intrinsic functions for efficient implementations of F# integer ranges
 and dynamic invocations of other F# operators

Unchecked

This module contains basic operations which do not apply runtime and/or static checks

Functions and values

Function or value Description

x ** y

Full Usage: x ** y

Parameters:
    x : ^T - The input base.
    y : ^U - The input exponent.

Returns: ^T The base raised to the exponent.
Modifiers: inline
Type parameters: ^T, ^U

Overloaded power operator.

x : ^T

The input base.

y : ^U

The input exponent.

Returns: ^T

The base raised to the exponent.

Example

 2.0 ** 3 // evaluates to 8.0

!cell

Full Usage: !cell

Parameters:
    cell : 'T ref - The cell to dereference.

Returns: 'T The value contained in the cell.

Dereference a mutable reference cell

cell : 'T ref

The cell to dereference.

Returns: 'T

The value contained in the cell.

Example

 let count = ref 12  // Creates a reference cell object with a mutable Value property
 count.Value         // Evaluates to 12
 !count              // Also evaluates to 12 (with shorter syntax)
val count: int ref
Multiple items
val ref: value: 'T -> 'T ref

--------------------
type 'T ref = Ref<'T>
property Ref.Value: int with get, set

x % y

Full Usage: x % y

Parameters:
    x : ^T1 - The first parameter.
    y : ^T2 - The second parameter.

Returns: ^T3 The result of the operation.
Modifiers: inline
Type parameters: ^T1, ^T2, ^T3

Overloaded modulo operator

x : ^T1

The first parameter.

y : ^T2

The second parameter.

Returns: ^T3

The result of the operation.

Example

 29 % 5 //  Evaluates to 4

x &&& y

Full Usage: x &&& y

Parameters:
    x : ^T - The first parameter.
    y : ^T - The second parameter.

Returns: ^T The result of the operation.
Modifiers: inline
Type parameters: ^T

Overloaded bitwise-AND operator

x : ^T

The first parameter.

y : ^T

The second parameter.

Returns: ^T

The result of the operation.

Example

 let a = 13       // 00000000000000000000000000001101
 let b = 11       // 00000000000000000000000000001011
 let c = a &&& b  // 00000000000000000000000000001001
val a: int
val b: int
val c: int
Evaluates to 9

x * y

Full Usage: x * y

Parameters:
    x : ^T1 - The first parameter.
    y : ^T2 - The second parameter.

Returns: ^T3 The result of the operation.
Modifiers: inline
Type parameters: ^T1, ^T2, ^T3

Overloaded multiplication operator

x : ^T1

The first parameter.

y : ^T2

The second parameter.

Returns: ^T3

The result of the operation.

Example

 8 * 6 //  Evaluates to 48

x + y

Full Usage: x + y

Parameters:
    x : ^T1 - The first parameter.
    y : ^T2 - The second parameter.

Returns: ^T3 The result of the operation.
Modifiers: inline
Type parameters: ^T1, ^T2, ^T3

Overloaded addition operator

x : ^T1

The first parameter.

y : ^T2

The second parameter.

Returns: ^T3

The result of the operation.

Example

 2 + 2 //  Evaluates to 4
 "Hello " + "Word" // Evaluates to "Hello World"

x - y

Full Usage: x - y

Parameters:
    x : ^T1 - The first parameter.
    y : ^T2 - The second parameter.

Returns: ^T3 The result of the operation.
Modifiers: inline
Type parameters: ^T1, ^T2, ^T3

Overloaded subtraction operator

x : ^T1

The first parameter.

y : ^T2

The second parameter.

Returns: ^T3

The result of the operation.

Example

 10 - 2 //  Evaluates to 8

(....) start step finish

Full Usage: (....) start step finish

Parameters:
    start : ^T - The start value of the range.
    step : ^Step - The step value of the range.
    finish : ^T - The end value of the range.

Returns: ^T seq The sequence spanning the range using the specified step size.
Modifiers: inline
Type parameters: ^T, ^Step

The standard overloaded skip range operator, e.g. [n..skip..m] for lists, seq {n..skip..m} for sequences

start : ^T

The start value of the range.

step : ^Step

The step value of the range.

finish : ^T

The end value of the range.

Returns: ^T seq

The sequence spanning the range using the specified step size.

Example

 [1..2..6]           //  Evaluates to [1; 3; 5]
 [1.1..0.2..1.5]     //  Evaluates to [1.1; 1.3; 1.5]
 ['a'..'e'] //  Evaluates to ['a'; 'b'; 'c'; 'd'; 'e']

(..) start finish

Full Usage: (..) start finish

Parameters:
    start : ^T - The start value of the range.
    finish : ^T - The end value of the range.

Returns: ^T seq The sequence spanning the range.
Modifiers: inline
Type parameters: ^T

The standard overloaded range operator, e.g. [n..m] for lists, seq {n..m} for sequences

start : ^T

The start value of the range.

finish : ^T

The end value of the range.

Returns: ^T seq

The sequence spanning the range.

Example

 [1..4]      //  Evaluates to [1; 2; 3; 4]
 [1.5..4.4]  //  Evaluates to [1.5; 2.5; 3.5]
 ['a'..'d']  //  Evaluates to ['a'; 'b'; 'c'; 'd']
 
 [|1..4|]    //  Evaluates to an array [|1; 2; 3; 4|]
 { 1..4 }    //  Evaluates to a sequence [1; 2; 3; 4])

x / y

Full Usage: x / y

Parameters:
    x : ^T1 - The first parameter.
    y : ^T2 - The second parameter.

Returns: ^T3 The result of the operation.
Modifiers: inline
Type parameters: ^T1, ^T2, ^T3

Overloaded division operator

x : ^T1

The first parameter.

y : ^T2

The second parameter.

Returns: ^T3

The result of the operation.

Example

 16 / 2 //  Evaluates to 8

cell := value

Full Usage: cell := value

Parameters:
    cell : 'T ref - The cell to mutate.
    value : 'T - The value to set inside the cell.

Assign to a mutable reference cell

cell : 'T ref

The cell to mutate.

value : 'T

The value to set inside the cell.

Example

 let count = ref 0   // Creates a reference cell object with a mutable Value property
 count.Value <- 1    // Updates the value
 count := 2          // Also updates the value, but with shorter syntax     
 count.Value         // Evaluates to 2
val count: int ref
Multiple items
val ref: value: 'T -> 'T ref

--------------------
type 'T ref = Ref<'T>
property Ref.Value: int with get, set

x < y

Full Usage: x < y

Parameters:
    x : 'T - The first parameter.
    y : 'T - The second parameter.

Returns: bool The result of the comparison.
Modifiers: inline
Type parameters: 'T

Structural less-than comparison

x : 'T

The first parameter.

y : 'T

The second parameter.

Returns: bool

The result of the comparison.

Example

 1 < 5               // Evaluates to true
 5 < 5               // Evaluates to false
 (1, "a") < (1, "z") // Evaluates to true

func2 << func1

Full Usage: func2 << func1

Parameters:
    func2 : 'T2 -> 'T3 - The second function to apply.
    func1 : 'T1 -> 'T2 - The first function to apply.

Returns: 'T1 -> 'T3 The composition of the input functions.
Modifiers: inline
Type parameters: 'T2, 'T3, 'T1

Compose two functions, the function on the right being applied first

func2 : 'T2 -> 'T3

The second function to apply.

func1 : 'T1 -> 'T2

The first function to apply.

Returns: 'T1 -> 'T3

The composition of the input functions.

Example

 let addOne x = x + 1
 let doubleIt x = x * 2
 let doubleThenAdd = addOne << doubleIt
 doubleThenAdd 3
val addOne: x: int -> int
val x: int
val doubleIt: x: int -> int
val doubleThenAdd: (int -> int)

value <<< shift

Full Usage: value <<< shift

Parameters:
    value : ^T - The input value.
    shift : int32 - The amount to shift.

Returns: ^T The result of the operation.
Modifiers: inline
Type parameters: ^T

Overloaded byte-shift left operator by a specified number of bits

value : ^T

The input value.

shift : int32

The amount to shift.

Returns: ^T

The result of the operation.

Example

 let a = 13       // 00000000000000000000000000001101
 let c = a <<< 4   // 00000000000000000000000011010000
val a: int
val c: int
Evaluates to 208

x <= y

Full Usage: x <= y

Parameters:
    x : 'T - The first parameter.
    y : 'T - The second parameter.

Returns: bool The result of the comparison.
Modifiers: inline
Type parameters: 'T

Structural less-than-or-equal comparison

x : 'T

The first parameter.

y : 'T

The second parameter.

Returns: bool

The result of the comparison.

Example

  5 <= 1              // Evaluates to false
  5 <= 5              // Evaluates to true
  [1; 5] <= [1; 6]    // Evaluates to true

x <> y

Full Usage: x <> y

Parameters:
    x : 'T - The first parameter.
    y : 'T - The second parameter.

Returns: bool The result of the comparison.
Modifiers: inline
Type parameters: 'T

Structural inequality

x : 'T

The first parameter.

y : 'T

The second parameter.

Returns: bool

The result of the comparison.

Example

  5 <> 5              // Evaluates to false
  5 <> 6              // Evaluates to true
  [1; 2] <> [1; 2]    // Evaluates to false

func <| arg1

Full Usage: func <| arg1

Parameters:
    func : 'T -> 'U - The function.
    arg1 : 'T - The argument.

Returns: 'U The function result.
Modifiers: inline
Type parameters: 'T, 'U

Apply a function to a value, the value being on the right, the function on the left

func : 'T -> 'U

The function.

arg1 : 'T

The argument.

Returns: 'U

The function result.

Example

 let doubleIt x = x * 2
 doubleIt <| 3  //  Evaluates to 6
val doubleIt: x: int -> int
val x: int

(<||) func (arg1, arg2)

Full Usage: (<||) func (arg1, arg2)

Parameters:
    func : 'T1 -> 'T2 -> 'U - The function.
    arg1 : 'T1 - The first argument.
    arg2 : 'T2 - The second argument.

Returns: 'U The function result.
Modifiers: inline
Type parameters: 'T1, 'T2, 'U

Apply a function to two values, the values being a pair on the right, the function on the left

func : 'T1 -> 'T2 -> 'U

The function.

arg1 : 'T1

The first argument.

arg2 : 'T2

The second argument.

Returns: 'U

The function result.

Example

 let sum x y = x + y
 sum <|| (3, 4)   // Evaluates to 7
val sum: x: int -> y: int -> int
val x: int
val y: int

(<|||) func (arg1, arg2, arg3)

Full Usage: (<|||) func (arg1, arg2, arg3)

Parameters:
    func : 'T1 -> 'T2 -> 'T3 -> 'U - The function.
    arg1 : 'T1 - The first argument.
    arg2 : 'T2 - The second argument.
    arg3 : 'T3 - The third argument.

Returns: 'U The function result.
Modifiers: inline
Type parameters: 'T1, 'T2, 'T3, 'U

Apply a function to three values, the values being a triple on the right, the function on the left

func : 'T1 -> 'T2 -> 'T3 -> 'U

The function.

arg1 : 'T1

The first argument.

arg2 : 'T2

The second argument.

arg3 : 'T3

The third argument.

Returns: 'U

The function result.

Example

 let sum3 x y z = x + y + z
 sum3 <||| (3, 4, 5)   // Evaluates to 12
val sum3: x: int -> y: int -> z: int -> int
val x: int
val y: int
val z: int

x = y

Full Usage: x = y

Parameters:
    x : 'T - The first parameter.
    y : 'T - The second parameter.

Returns: bool The result of the comparison.
Modifiers: inline
Type parameters: 'T

Structural equality

x : 'T

The first parameter.

y : 'T

The second parameter.

Returns: bool

The result of the comparison.

Example

  5 = 5              // Evaluates to true
  5 = 6              // Evaluates to false
  [1; 2] = [1; 2]    // Evaluates to true
  (1, 5) = (1, 6)    // Evaluates to false

x > y

Full Usage: x > y

Parameters:
    x : 'T - The first parameter.
    y : 'T - The second parameter.

Returns: bool The result of the comparison.
Modifiers: inline
Type parameters: 'T

Structural greater-than

x : 'T

The first parameter.

y : 'T

The second parameter.

Returns: bool

The result of the comparison.

Example

  5 > 1               // Evaluates to true
  5 > 5               // Evaluates to false
  (1, "a") > (1, "z") // Evaluates to false

x >= y

Full Usage: x >= y

Parameters:
    x : 'T - The first parameter.
    y : 'T - The second parameter.

Returns: bool The result of the comparison.
Modifiers: inline
Type parameters: 'T

Structural greater-than-or-equal

x : 'T

The first parameter.

y : 'T

The second parameter.

Returns: bool

The result of the comparison.

Example

  5 >= 1              // Evaluates to true
  5 >= 5              // Evaluates to true
  [1; 5] >= [1; 6]    // Evaluates to false

func1 >> func2

Full Usage: func1 >> func2

Parameters:
    func1 : 'T1 -> 'T2 - The first function to apply.
    func2 : 'T2 -> 'T3 - The second function to apply.

Returns: 'T1 -> 'T3 The composition of the input functions.
Modifiers: inline
Type parameters: 'T1, 'T2, 'T3

Compose two functions, the function on the left being applied first

func1 : 'T1 -> 'T2

The first function to apply.

func2 : 'T2 -> 'T3

The second function to apply.

Returns: 'T1 -> 'T3

The composition of the input functions.

Example

 let addOne x = x + 1
 let doubleIt x = x * 2
 let addThenDouble = addOne >> doubleIt
 addThenDouble 3  // Evaluates to 8
val addOne: x: int -> int
val x: int
val doubleIt: x: int -> int
val addThenDouble: (int -> int)

value >>> shift

Full Usage: value >>> shift

Parameters:
    value : ^T - The input value.
    shift : int32 - The amount to shift.

Returns: ^T The result of the operation.
Modifiers: inline
Type parameters: ^T

Overloaded byte-shift right operator by a specified number of bits

value : ^T

The input value.

shift : int32

The amount to shift.

Returns: ^T

The result of the operation.

Example

 let a = 206      // 00000000000000000000000011010000
 let c1 = a >>> 2  // 00000000000000000000000000110100
 // Evaluates to 51
 let c2 = a >>> 6  // 00000000000000000000000000000011
 Evaluates to 3
val a: int
val c1: int
val c2: int

list1 @ list2

Full Usage: list1 @ list2

Parameters:
    list1 : 'T list - The first list.
    list2 : 'T list - The second list.

Returns: 'T list The concatenation of the lists.

Concatenate two lists.

list1 : 'T list

The first list.

list2 : 'T list

The second list.

Returns: 'T list

The concatenation of the lists.

Example

 let l1 = ['a'; 'b'; 'c']
 let l2 = ['d'; 'e'; 'f']
 l1 @ l2   //  Evalulates to ['a'; 'b'; 'c'; 'd'; 'e'; 'f']
val l1: char list
val l2: char list

s1 ^ s2

Full Usage: s1 ^ s2

Parameters:
Returns: string

Concatenate two strings. The operator '+' may also be used.

s1 : string
s2 : string
Returns: string

x ^^^ y

Full Usage: x ^^^ y

Parameters:
    x : ^T - The first parameter.
    y : ^T - The second parameter.

Returns: ^T The result of the operation.
Modifiers: inline
Type parameters: ^T

Overloaded bitwise-XOR operator

x : ^T

The first parameter.

y : ^T

The second parameter.

Returns: ^T

The result of the operation.

Example

 let a = 13       // 00000000000000000000000000001101
 let b = 11       // 00000000000000000000000000001011
 let c = a ^^^ b  // 00000000000000000000000000000110
val a: int
val b: int
val c: int
Evaluates to 6

arg |> func

Full Usage: arg |> func

Parameters:
    arg : 'T1 - The argument.
    func : 'T1 -> 'U - The function.

Returns: 'U The function result.
Modifiers: inline
Type parameters: 'T1, 'U

Apply a function to a value, the value being on the left, the function on the right

arg : 'T1

The argument.

func : 'T1 -> 'U

The function.

Returns: 'U

The function result.

Example

 let doubleIt x = x * 2
 3 |> doubleIt  //  Evaluates to 6
val doubleIt: x: int -> int
val x: int

(||>) (arg1, arg2) func

Full Usage: (||>) (arg1, arg2) func

Parameters:
    arg1 : 'T1 - The first argument.
    arg2 : 'T2 - The second argument.
    func : 'T1 -> 'T2 -> 'U - The function.

Returns: 'U The function result.
Modifiers: inline
Type parameters: 'T1, 'T2, 'U

Apply a function to two values, the values being a pair on the left, the function on the right

arg1 : 'T1

The first argument.

arg2 : 'T2

The second argument.

func : 'T1 -> 'T2 -> 'U

The function.

Returns: 'U

The function result.

Example

 let sum x y = x + y
 (3, 4) ||> sum   // Evaluates to 7
val sum: x: int -> y: int -> int
val x: int
val y: int

x ||| y

Full Usage: x ||| y

Parameters:
    x : ^T - The first parameter.
    y : ^T - The second parameter.

Returns: ^T The result of the operation.
Modifiers: inline
Type parameters: ^T

Overloaded bitwise-OR operator

x : ^T

The first parameter.

y : ^T

The second parameter.

Returns: ^T

The result of the operation.

Example

 let a = 13       // 00000000000000000000000000001101
 let b = 11       // 00000000000000000000000000001011
 let c = a ||| b  // 00000000000000000000000000001111
val a: int
val b: int
val c: int
Evaluates to 15

(|||>) (arg1, arg2, arg3) func

Full Usage: (|||>) (arg1, arg2, arg3) func

Parameters:
    arg1 : 'T1 - The first argument.
    arg2 : 'T2 - The second argument.
    arg3 : 'T3 - The third argument.
    func : 'T1 -> 'T2 -> 'T3 -> 'U - The function.

Returns: 'U The function result.
Modifiers: inline
Type parameters: 'T1, 'T2, 'T3, 'U

Apply a function to three values, the values being a triple on the left, the function on the right

arg1 : 'T1

The first argument.

arg2 : 'T2

The second argument.

arg3 : 'T3

The third argument.

func : 'T1 -> 'T2 -> 'T3 -> 'U

The function.

Returns: 'U

The function result.

Example

 let sum3 x y z = x + y + z
 (3, 4, 5) |||> sum3   // Evaluates to 12
val sum3: x: int -> y: int -> z: int -> int
val x: int
val y: int
val z: int

~+value

Full Usage: ~+value

Parameters:
    value : ^T - The input value.

Returns: ^T The result of the operation.
Modifiers: inline
Type parameters: ^T

Overloaded prefix-plus operator

value : ^T

The input value.

Returns: ^T

The result of the operation.

~-n

Full Usage: ~-n

Parameters:
    n : ^T - The value to negate.

Returns: ^T The result of the operation.
Modifiers: inline
Type parameters: ^T

Overloaded unary negation.

n : ^T

The value to negate.

Returns: ^T

The result of the operation.

~~~value

Full Usage: ~~~value

Parameters:
    value : ^T - The input value.

Returns: ^T The result of the operation.
Modifiers: inline
Type parameters: ^T

Overloaded bitwise-NOT operator

value : ^T

The input value.

Returns: ^T

The result of the operation.

Example

 let byte1 = 60uy  //  00111100
 let byte2 = ~~~b1 //  11000011
val byte1: byte
val byte2: int
Evaluates to 195

Failure message

Full Usage: Failure message

Parameters:
    message : string - The message for the Exception.

Returns: exn A System.Exception.

Builds a Exception object.

message : string

The message for the Exception.

Returns: exn

A System.Exception.

Example

 let throwException() = 
     raise(Failure("Oh no!!!")) 
     true  // Never gets here
   
   throwException() //  Throws a generic Exception class
val throwException: unit -> bool
val raise: exn: System.Exception -> 'T
Multiple items
val Failure: message: string -> exn

--------------------
active recognizer Failure: exn -> string option

``not`` value

Full Usage: ``not`` value

Parameters:
    value : bool - The value to negate.

Returns: bool The result of the negation.
Modifiers: inline

Negate a logical value. Not True equals False and not False equals True

value : bool

The value to negate.

Returns: bool

The result of the negation.

Example

 not (2 + 2 = 5)     // Evaluates to true 
 
 //  not is a function that can be compose with other functions
 let fileDoesNotExist = System.IO.File.Exists >> not
val fileDoesNotExist: (string -> bool)
namespace System
namespace System.IO
type File = static member AppendAllBytes: path: string * bytes: byte array -> unit static member AppendAllBytesAsync: path: string * bytes: byte array * ?cancellationToken: CancellationToken -> Task static member AppendAllLines: path: string * contents: IEnumerable<string> -> unit + 1 overload static member AppendAllLinesAsync: path: string * contents: IEnumerable<string> * encoding: Encoding * ?cancellationToken: CancellationToken -> Task + 1 overload static member AppendAllText: path: string * contents: string -> unit + 1 overload static member AppendAllTextAsync: path: string * contents: string * encoding: Encoding * ?cancellationToken: CancellationToken -> Task + 1 overload static member AppendText: path: string -> StreamWriter static member Copy: sourceFileName: string * destFileName: string -> unit + 1 overload static member Create: path: string -> FileStream + 2 overloads static member CreateSymbolicLink: path: string * pathToTarget: string -> FileSystemInfo ...
<summary>Provides static methods for the creation, copying, deletion, moving, and opening of a single file, and aids in the creation of <see cref="T:System.IO.FileStream" /> objects.</summary>
System.IO.File.Exists(path: string) : bool

abs value

Full Usage: abs value

Parameters:
    value : ^T - The input value.

Returns: ^T The absolute value of the input.
Modifiers: inline
Type parameters: ^T

Absolute value of the given number.

value : ^T

The input value.

Returns: ^T

The absolute value of the input.

Example

 abs -12    // Evaluates to 12
 abs -15.0  // Evaluates to 15.0
val abs: value: 'T -> 'T (requires member Abs)

acos value

Full Usage: acos value

Parameters:
    value : ^T - The input value.

Returns: ^T The inverse cosine of the input.
Modifiers: inline
Type parameters: ^T

Inverse cosine of the given number

value : ^T

The input value.

Returns: ^T

The inverse cosine of the input.

Example

 let angleFromAdjacent adjacent hypotenuse = acos(adjacent / hypotenuse)
 angleFromAdjacent 8.0 10.0  //  Evaluates to 0.6435011088
val angleFromAdjacent: adjacent: float -> hypotenuse: float -> float
val adjacent: float
val hypotenuse: float
val acos: value: 'T -> 'T (requires member Acos)

asin value

Full Usage: asin value

Parameters:
    value : ^T - The input value.

Returns: ^T The inverse sine of the input.
Modifiers: inline
Type parameters: ^T

Inverse sine of the given number

value : ^T

The input value.

Returns: ^T

The inverse sine of the input.

Example

 let angleFromOpposite opposite hypotenuse = asin(opposite / hypotenuse)
 angleFromOpposite 6.0 10.0  //  Evaluates to 0.6435011088
 angleFromOpposite 5.0 3.0  //  Evaluates to nan
val angleFromOpposite: opposite: float -> hypotenuse: float -> float
val opposite: float
val hypotenuse: float
val asin: value: 'T -> 'T (requires member Asin)

atan value

Full Usage: atan value

Parameters:
    value : ^T - The input value.

Returns: ^T The inverse tangent of the input.
Modifiers: inline
Type parameters: ^T

Inverse tangent of the given number

value : ^T

The input value.

Returns: ^T

The inverse tangent of the input.

Example

 let angleFrom opposite adjacent = atan(opposite / adjacent)
 angleFrom 5.0 5.0   //  Evaluates to 0.7853981634
val angleFrom: opposite: float -> adjacent: float -> float
val opposite: float
val adjacent: float
val atan: value: 'T -> 'T (requires member Atan)

atan2 y x

Full Usage: atan2 y x

Parameters:
    y : ^T1 - The y input value.
    x : ^T1 - The x input value.

Returns: 'T2 The inverse tangent of the input ratio.
Modifiers: inline
Type parameters: ^T1, 'T2

Inverse tangent of x/y where x and y are specified separately

y : ^T1

The y input value.

x : ^T1

The x input value.

Returns: 'T2

The inverse tangent of the input ratio.

Example

 let angleFromPlaneAtXY x y = atan2 y x * 180.0 / System.Math.PI
 angleFromPlaneAtXY 0.0 -1.0   //  Evaluates to -90.0
 angleFromPlaneAtXY 1.0 1.0    //  Evaluates to 45.0
 angleFromPlaneAtXY -1.0 1.0   //  Evaluates to 135.0
val angleFromPlaneAtXY: x: float -> y: float -> float
val x: float
val y: float
val atan2: y: 'T1 -> x: 'T1 -> 'T2 (requires member Atan2)
namespace System
type Math = static member Abs: value: decimal -> decimal + 7 overloads static member Acos: d: float -> float static member Acosh: d: float -> float static member Asin: d: float -> float static member Asinh: d: float -> float static member Atan: d: float -> float static member Atan2: y: float * x: float -> float static member Atanh: d: float -> float static member BigMul: a: int * b: int -> int64 + 2 overloads static member BitDecrement: x: float -> float ...
<summary>Provides constants and static methods for trigonometric, logarithmic, and other common mathematical functions.</summary>
field System.Math.PI: float = 3.14159265359

box value

Full Usage: box value

Parameters:
    value : 'T - The value to box.

Returns: obj The boxed object.
Modifiers: inline
Type parameters: 'T

Boxes a strongly typed value.

value : 'T

The value to box.

Returns: obj

The boxed object.

Example

 let x: int = 123
 let obj1 = box x    //  obj1 is a generic object type
 unbox<int> obj1     //  Evaluates to 123 (int)
 unbox<double> obj1  //  Throws System.InvalidCastException
val x: int
Multiple items
val int: value: 'T -> int (requires member op_Explicit)

--------------------
type int = int32

--------------------
type int<'Measure> = int
val obj1: obj
val box: value: 'T -> obj
val unbox: value: obj -> 'T
Multiple items
val double: value: 'T -> double (requires member op_Explicit)

--------------------
type double = System.Double

--------------------
type double<'Measure> = float<'Measure>

byte value

Full Usage: byte value

Parameters:
    value : ^T - The input value.

Returns: byte The converted byte
Modifiers: inline
Type parameters: ^T

Converts the argument to byte. This is a direct conversion for all primitive numeric types. For strings, the input is converted using Byte.Parse() with InvariantCulture settings. Otherwise the operation requires an appropriate static conversion method on the input type.

value : ^T

The input value.

Returns: byte

The converted byte

Example

 byte 'A'  // evaluates to 65uy
 byte 0xff // evaluates to 255uy
 byte -10  // evaluates to 246uy
Multiple items
val byte: value: 'T -> byte (requires member op_Explicit)

--------------------
type byte = System.Byte

--------------------
type byte<'Measure> = byte

ceil value

Full Usage: ceil value

Parameters:
    value : ^T - The input value.

Returns: ^T The ceiling of the input.
Modifiers: inline
Type parameters: ^T

Ceiling of the given number

value : ^T

The input value.

Returns: ^T

The ceiling of the input.

Example

 ceil 12.1  //  Evaluates to 13.0
 ceil -1.9  //  Evaluates to -1.0
val ceil: value: 'T -> 'T (requires member Ceiling)

char value

Full Usage: char value

Parameters:
    value : ^T - The input value.

Returns: char The converted char.
Modifiers: inline
Type parameters: ^T

Converts the argument to character. Numeric inputs are converted according to the UTF-16 encoding for characters. String inputs must be exactly one character long. For other input types the operation requires an appropriate static conversion method on the input type.

value : ^T

The input value.

Returns: char

The converted char.

Example

 char "A"  // evaluates to 'A'
 char 0x41 // evaluates to 'A'
 char 65   // evaluates to 'A'
Multiple items
val char: value: 'T -> char (requires member op_Explicit)

--------------------
type char = System.Char

compare e1 e2

Full Usage: compare e1 e2

Parameters:
    e1 : 'T - The first value.
    e2 : 'T - The second value.

Returns: int The result of the comparison.
Modifiers: inline
Type parameters: 'T

Generic comparison.

e1 : 'T

The first value.

e2 : 'T

The second value.

Returns: int

The result of the comparison.

Example

 compare 1 2             //  Evaluates to -1
 compare [1;2;3] [1;2;4] //  Evaluates to -1
 compare 2 2             //  Evaluates to 0
 compare [1;2;3] [1;2;3] //  Evaluates to 0
 compare 2 1             //  Evaluates to 1
 compare [1;2;4] [1;2;3] //  Evaluates to 1
val compare: e1: 'T -> e2: 'T -> int (requires comparison)

cos value

Full Usage: cos value

Parameters:
    value : ^T - The input value.

Returns: ^T The cosine of the input.
Modifiers: inline
Type parameters: ^T

Cosine of the given number

value : ^T

The input value.

Returns: ^T

The cosine of the input.

Example

 cos (0.0 * System.Math.PI) // evaluates to 1.0
 cos (0.5 * System.Math.PI) // evaluates to 6.123233996e-17
 cos (1.0 * System.Math.PI) // evaluates to -1.0
val cos: value: 'T -> 'T (requires member Cos)
namespace System
type Math = static member Abs: value: decimal -> decimal + 7 overloads static member Acos: d: float -> float static member Acosh: d: float -> float static member Asin: d: float -> float static member Asinh: d: float -> float static member Atan: d: float -> float static member Atan2: y: float * x: float -> float static member Atanh: d: float -> float static member BigMul: a: int * b: int -> int64 + 2 overloads static member BitDecrement: x: float -> float ...
<summary>Provides constants and static methods for trigonometric, logarithmic, and other common mathematical functions.</summary>
field System.Math.PI: float = 3.14159265359
<summary>Represents the ratio of the circumference of a circle to its diameter, specified by the constant, π.</summary>

cosh value

Full Usage: cosh value

Parameters:
    value : ^T - The input value.

Returns: ^T The hyperbolic cosine of the input.
Modifiers: inline
Type parameters: ^T

Hyperbolic cosine of the given number

value : ^T

The input value.

Returns: ^T

The hyperbolic cosine of the input.

Example

 cosh -1.0 // evaluates to 1.543080635
 cosh 0.0  // evaluates to 1.0
 cosh 1.0  // evaluates to 1.543080635
val cosh: value: 'T -> 'T (requires member Cosh)

decimal value

Full Usage: decimal value

Parameters:
    value : ^T - The input value.

Returns: decimal The converted decimal.
Modifiers: inline
Type parameters: ^T

Converts the argument to System.Decimal using a direct conversion for all primitive numeric types. For strings, the input is converted using UInt64.Parse() with InvariantCulture settings. Otherwise the operation requires an appropriate static conversion method on the input type.

value : ^T

The input value.

Returns: decimal

The converted decimal.

Example

 decimal "42.23" // evaluates to 42.23M
 decimal 0xff    // evaluates to 255M
 decimal -10     // evaluates to -10M
Multiple items
val decimal: value: 'T -> decimal (requires member op_Explicit)

--------------------
type decimal = System.Decimal

--------------------
type decimal<'Measure> = decimal

decr cell

Full Usage: decr cell

Parameters:
    cell : int ref - The reference cell.

Decrement a mutable reference cell containing an integer

cell : int ref

The reference cell.

Example

 let count = ref 99  // Creates a reference cell object with a mutable Value property
 decr count          // Decrements our counter
 count.Value         // Evaluates to 98
val count: int ref
Multiple items
val ref: value: 'T -> 'T ref

--------------------
type 'T ref = Ref<'T>
val decr: cell: int ref -> unit
property Ref.Value: int with get, set

defaultArg arg defaultValue

Full Usage: defaultArg arg defaultValue

Parameters:
    arg : 'T option - An option representing the argument.
    defaultValue : 'T - The default value of the argument.

Returns: 'T The argument value. If it is None, the defaultValue is returned.

Used to specify a default value for an optional argument in the implementation of a function

arg : 'T option

An option representing the argument.

defaultValue : 'T

The default value of the argument.

Returns: 'T

The argument value. If it is None, the defaultValue is returned.

Example

 type Vector(x: double, y: double, ?z: double) = 
     let z = defaultArg z 0.0
     member this.X = x
     member this.Y = y
     member this.Z = z
 
 let v1 = Vector(1.0, 2.0)
 v1.Z  // Evaluates to 0.
 let v2 = Vector(1.0, 2.0, 3.0)
 v2.Z  // Evaluates to 3.0
Multiple items
type Vector = new: x: double * y: double * ?z: double -> Vector member X: double member Y: double member Z: double

--------------------
new: x: double * y: double * ?z: double -> Vector
val x: double
Multiple items
val double: value: 'T -> double (requires member op_Explicit)

--------------------
type double = System.Double

--------------------
type double<'Measure> = float<'Measure>
val y: double
val z: double option
val z: double
val defaultArg: arg: 'T option -> defaultValue: 'T -> 'T
val this: Vector
member Vector.X: double
member Vector.Y: double
member Vector.Z: double
val v1: Vector
property Vector.Z: double with get
val v2: Vector

defaultValueArg arg defaultValue

Full Usage: defaultValueArg arg defaultValue

Parameters:
    arg : 'T voption - A value option representing the argument.
    defaultValue : 'T - The default value of the argument.

Returns: 'T The argument value. If it is None, the defaultValue is returned.

Used to specify a default value for an optional argument in the implementation of a function

arg : 'T voption

A value option representing the argument.

defaultValue : 'T

The default value of the argument.

Returns: 'T

The argument value. If it is None, the defaultValue is returned.

Example

 let arg1 = ValueSome(5)
 defaultValueArg arg1 6       //  Evaluates to 5
 defaultValueArg ValueNone 6  //  Evaluates to 6
val arg1: int voption
union case ValueOption.ValueSome: 'T -> ValueOption<'T>
val defaultValueArg: arg: 'T voption -> defaultValue: 'T -> 'T
union case ValueOption.ValueNone: ValueOption<'T>

enum value

Full Usage: enum value

Parameters:
    value : int32 - The input value.

Returns: ^U The converted enum type.
Modifiers: inline
Type parameters: ^U

Converts the argument to a particular enum type.

value : int32

The input value.

Returns: ^U

The converted enum type.

Example

 type Color =
 | Red = 1
 | Green = 2
 | Blue = 3
 let c: Color = enum 3 // c evaluates to Blue
[<Struct>] type Color = | Red = 1 | Green = 2 | Blue = 3
val c: Color
val enum: value: int32 -> 'U (requires enum)

exit exitcode

Full Usage: exit exitcode

Parameters:
    exitcode : int - The exit code to use.

Returns: 'T Never returns.

Exit the current hardware isolated process, if security settings permit, otherwise raise an exception. Calls Environment.Exit.

exitcode : int

The exit code to use.

Returns: 'T

Never returns.

Example

 [<EntryPoint>]
 let main argv = 
     if argv.Length = 0 then
         eprintfn "You must provide arguments"
         exit(-1)  // Causes program to quit with an error code
     printfn "Argument count: %i" argv.Length
     0
Multiple items
type EntryPointAttribute = inherit Attribute new: unit -> EntryPointAttribute

--------------------
new: unit -> EntryPointAttribute
val main: argv: string array -> int
val argv: string array
property System.Array.Length: int with get
<summary>Gets the total number of elements in all the dimensions of the <see cref="T:System.Array" />.</summary>
<exception cref="T:System.OverflowException">The array is multidimensional and contains more than <see cref="F:System.Int32.MaxValue">Int32.MaxValue</see> elements.</exception>
<returns>The total number of elements in all the dimensions of the <see cref="T:System.Array" />; zero if there are no elements in the array.</returns>
val eprintfn: format: Printf.TextWriterFormat<'T> -> 'T
val exit: exitcode: int -> 'T
val printfn: format: Printf.TextWriterFormat<'T> -> 'T

exp value

Full Usage: exp value

Parameters:
    value : ^T - The input value.

Returns: ^T The exponential of the input.
Modifiers: inline
Type parameters: ^T

Exponential of the given number

value : ^T

The input value.

Returns: ^T

The exponential of the input.

Example

 exp 0.0   //  Evaluates to 1.0
 exp 1.0   //  Evaluates to 2.718281828
 exp -1.0  //  Evaluates to 0.3678794412
 exp 2.0   //  Evaluates to 7.389056099
val exp: value: 'T -> 'T (requires member Exp)

failwith message

Full Usage: failwith message

Parameters:
    message : string - The exception message.

Returns: 'T Never returns.
Modifiers: inline
Type parameters: 'T

Throw a Exception exception.

message : string

The exception message.

Returns: 'T

Never returns.

Example

 let failingFunction() = 
     failwith "Oh no" // Throws an exception
     true  // Never reaches this
   
 failingFunction()  // Throws a System.Exception
val failingFunction: unit -> bool
val failwith: message: string -> 'T

float value

Full Usage: float value

Parameters:
    value : ^T - The input value.

Returns: float The converted float
Modifiers: inline
Type parameters: ^T

Converts the argument to 64-bit float. This is a direct conversion for all primitive numeric types. For strings, the input is converted using Double.Parse() with InvariantCulture settings. Otherwise the operation requires an appropriate static conversion method on the input type.

value : ^T

The input value.

Returns: float

The converted float

Example

 float 'A'  // evaluates to 65.0
 float 0xff // evaluates to 255.0
 float -10  // evaluates to -10.0
Multiple items
val float: value: 'T -> float (requires member op_Explicit)

--------------------
type float = System.Double

--------------------
type float<'Measure> = float

float32 value

Full Usage: float32 value

Parameters:
    value : ^T - The input value.

Returns: float32 The converted float32
Modifiers: inline
Type parameters: ^T

Converts the argument to 32-bit float. This is a direct conversion for all primitive numeric types. For strings, the input is converted using Single.Parse() with InvariantCulture settings. Otherwise the operation requires an appropriate static conversion method on the input type.

value : ^T

The input value.

Returns: float32

The converted float32

Example

 float32 'A'  // evaluates to 65.0f
 float32 0xff // evaluates to 255.0f
 float32 -10  // evaluates to -10.0f
Multiple items
val float32: value: 'T -> float32 (requires member op_Explicit)

--------------------
type float32 = System.Single

--------------------
type float32<'Measure> = float32

floor value

Full Usage: floor value

Parameters:
    value : ^T - The input value.

Returns: ^T The floor of the input.
Modifiers: inline
Type parameters: ^T

Floor of the given number

value : ^T

The input value.

Returns: ^T

The floor of the input.

Example

 floor 12.1  //  Evaluates to 12.0
 floor -1.9  //  Evaluates to -2.0
val floor: value: 'T -> 'T (requires member Floor)

fst tuple

Full Usage: fst tuple

Parameters:
    tuple : 'T1 * 'T2 - The input tuple.

Returns: 'T1 The first value.
Modifiers: inline
Type parameters: 'T1, 'T2

Return the first element of a tuple, fst (a,b) = a.

tuple : 'T1 * 'T2

The input tuple.

Returns: 'T1

The first value.

Example

 fst ("first", 2)  //  Evaluates to "first"
val fst: tuple: ('T1 * 'T2) -> 'T1

hash obj

Full Usage: hash obj

Parameters:
    obj : 'T - The input object.

Returns: int The computed hash.
Modifiers: inline
Type parameters: 'T

A generic hash function, designed to return equal hash values for items that are equal according to the "=" operator. By default it will use structural hashing for F# union, record and tuple types, hashing the complete contents of the type. The exact behaviour of the function can be adjusted on a type-by-type basis by implementing GetHashCode for each type.

obj : 'T

The input object.

Returns: int

The computed hash.

Example

 hash "Bob Jones"  // Evaluates to -325251320
val hash: obj: 'T -> int (requires equality)

id x

Full Usage: id x

Parameters:
    x : 'T - The input value.

Returns: 'T The same value.

The identity function

x : 'T

The input value.

Returns: 'T

The same value.

Example

 id 12     //  Evaulates to 12
 id "abc"  //  Evaulates to "abc"
val id: x: 'T -> 'T

ignore value

Full Usage: ignore value

Parameters:
    value : 'T - The value to ignore.

Modifiers: inline
Type parameters: 'T

Ignore the passed value. This is often used to throw away results of a computation.

value : 'T

The value to ignore.

Example

  ignore 55555   //  Evaluates to ()
val ignore: value: 'T -> unit

incr cell

Full Usage: incr cell

Parameters:
    cell : int ref - The reference cell.

Increment a mutable reference cell containing an integer

cell : int ref

The reference cell.

Example

 let count = ref 99  // Creates a reference cell object with a mutable Value property
 incr count          // Increments our counter
 count.Value         // Evaluates to 100
val count: int ref
Multiple items
val ref: value: 'T -> 'T ref

--------------------
type 'T ref = Ref<'T>
val incr: cell: int ref -> unit
property Ref.Value: int with get, set

infinity

Full Usage: infinity

Returns: float
Returns: float

infinityf

Full Usage: infinityf

Returns: float32
Returns: float32

int value

Full Usage: int value

Parameters:
    value : ^T - The input value.

Returns: int The converted int
Modifiers: inline
Type parameters: ^T

Converts the argument to signed 32-bit integer. This is a direct conversion for all primitive numeric types. For strings, the input is converted using Int32.Parse() with InvariantCulture settings. Otherwise the operation requires an appropriate static conversion method on the input type.

value : ^T

The input value.

Returns: int

The converted int

Example

 int 'A'  // evaluates to 65
 int 0xff // evaluates to 255
 int -10  // evaluates to -10
Multiple items
val int: value: 'T -> int (requires member op_Explicit)

--------------------
type int = int32

--------------------
type int<'Measure> = int

int16 value

Full Usage: int16 value

Parameters:
    value : ^T - The input value.

Returns: int16 The converted int16
Modifiers: inline
Type parameters: ^T

Converts the argument to signed 16-bit integer. This is a direct conversion for all primitive numeric types. For strings, the input is converted using Int16.Parse() with InvariantCulture settings. Otherwise the operation requires an appropriate static conversion method on the input type.

value : ^T

The input value.

Returns: int16

The converted int16

Example

 int16 'A'  // evaluates to 65s
 int16 0xff // evaluates to 255s
 int16 -10  // evaluates to -10s
Multiple items
val int16: value: 'T -> int16 (requires member op_Explicit)

--------------------
type int16 = System.Int16

--------------------
type int16<'Measure> = int16

int32 value

Full Usage: int32 value

Parameters:
    value : ^T - The input value.

Returns: int32 The converted int32
Modifiers: inline
Type parameters: ^T

Converts the argument to signed 32-bit integer. This is a direct conversion for all primitive numeric types. For strings, the input is converted using Int32.Parse() with InvariantCulture settings. Otherwise the operation requires an appropriate static conversion method on the input type.

value : ^T

The input value.

Returns: int32

The converted int32

Example

 int32 'A'  // evaluates to 65
 int32 0xff // evaluates to 255
 int32 -10  // evaluates to -10
Multiple items
val int32: value: 'T -> int32 (requires member op_Explicit)

--------------------
type int32 = System.Int32

--------------------
type int32<'Measure> = int<'Measure>

int64 value

Full Usage: int64 value

Parameters:
    value : ^T - The input value.

Returns: int64 The converted int64
Modifiers: inline
Type parameters: ^T

Converts the argument to signed 64-bit integer. This is a direct conversion for all primitive numeric types. For strings, the input is converted using Int64.Parse() with InvariantCulture settings. Otherwise the operation requires an appropriate static conversion method on the input type.

value : ^T

The input value.

Returns: int64

The converted int64

Example

 int64 'A'  // evaluates to 65L
 int64 0xff // evaluates to 255L
 int64 -10  // evaluates to -10L
Multiple items
val int64: value: 'T -> int64 (requires member op_Explicit)

--------------------
type int64 = System.Int64

--------------------
type int64<'Measure> = int64

invalidArg argumentName message

Full Usage: invalidArg argumentName message

Parameters:
    argumentName : string - The argument name.
    message : string - The exception message.

Returns: 'T Never returns.
Modifiers: inline
Type parameters: 'T

Throw a ArgumentException exception with the given argument name and message.

argumentName : string

The argument name.

message : string

The exception message.

Returns: 'T

Never returns.

Example

 let fullName firstName lastName = 
     if String.IsNullOrWhiteSpace(firstName) then
         invalidArg (nameof(firstName)) "First name can't be null or blank"
         if String.IsNullOrWhiteSpace(lastName) then
             invalidArg (nameof(lastName)) "Last name can't be null or blank"
     firstName + " " + lastName
   
 fullName null "Jones"
val fullName: firstName: string -> lastName: string -> string
val firstName: string
val lastName: string
module String from Microsoft.FSharp.Core
val invalidArg: argumentName: string -> message: string -> 'T
val nameof: 'T -> string
Throws System.ArgumentException: First name can't be null or blank (Parameter 'firstName')

invalidOp message

Full Usage: invalidOp message

Parameters:
    message : string - The exception message.

Returns: 'T The result value.
Modifiers: inline
Type parameters: 'T

Throw a InvalidOperationException exception

message : string

The exception message.

Returns: 'T

The result value.

Example

 type FileReader(fileName: string) = 
     let mutable isOpen = false
     member this.Open() = 
       if isOpen then invalidOp "File is already open"
       //  ... Here we may open the file ...
       isOpen <- true
 
 let reader = FileReader("journal.txt")
 reader.Open()  //  Executes fine
 reader.Open()  //  Throws System.InvalidOperationException: File is already open
Multiple items
type FileReader = new: fileName: string -> FileReader member Open: unit -> unit

--------------------
new: fileName: string -> FileReader
val fileName: string
Multiple items
val string: value: 'T -> string

--------------------
type string = System.String
val mutable isOpen: bool
val this: FileReader
val invalidOp: message: string -> 'T
val reader: FileReader
member FileReader.Open: unit -> unit

isNull value

Full Usage: isNull value

Parameters:
    value : 'T - The value to check.

Returns: bool True when value is null, false otherwise.
Modifiers: inline
Type parameters: 'T

Determines whether the given value is null.

value : 'T

The value to check.

Returns: bool

True when value is null, false otherwise.

Example

 isNull null        //  Evaluates to true
 isNull "Not null"  //  Evaluates to false
val isNull: value: 'T -> bool (requires 'T: null)

limitedHash limit obj

Full Usage: limitedHash limit obj

Parameters:
    limit : int - The limit of nodes.
    obj : 'T - The input object.

Returns: int The computed hash.
Modifiers: inline
Type parameters: 'T

A generic hash function. This function has the same behaviour as 'hash', however the default structural hashing for F# union, record and tuple types stops when the given limit of nodes is reached. The exact behaviour of the function can be adjusted on a type-by-type basis by implementing GetHashCode for each type.

limit : int

The limit of nodes.

obj : 'T

The input object.

Returns: int

The computed hash.

lock lockObject action

Full Usage: lock lockObject action

Parameters:
    lockObject : 'Lock - The object to be locked.
    action : unit -> 'T - The action to perform during the lock.

Returns: 'T The resulting value.
Modifiers: inline
Type parameters: 'Lock, 'T

Execute the function as a mutual-exclusion region using the input value as a lock.

lockObject : 'Lock

The object to be locked.

action : unit -> 'T

The action to perform during the lock.

Returns: 'T

The resulting value.

Example

 open System.Linq

 /// A counter object, supporting unlocked and locked increment
 type TestCounter () =
     let mutable count = 0
     
     /// Increment the counter, unlocked
     member this.IncrementWithoutLock() =
         count <- count + 1

     /// Increment the counter, locked
     member this.IncrementWithLock() = 
         lock this (fun () -> count <- count + 1)

     /// Get the count
     member this.Count = count
         
 let counter = TestCounter()

 // Create a parallel sequence to that uses all our CPUs
 (seq {1..100000}).AsParallel()
     .ForAll(fun _ -> counter.IncrementWithoutLock())
 
 // Evaluates to a number between 1-100000, non-deterministically because there is no locking
 counter.Count
 
 let counter2 = TestCounter()

 //  Create a parallel sequence to that uses all our CPUs
 (seq {1..100000}).AsParallel()
     .ForAll(fun _ -> counter2.IncrementWithLock())
 
 //  Evaluates to 100000 deterministically because the increment to the counter object is locked
 counter2.Count
namespace System
namespace System.Linq
Multiple items
type TestCounter = new: unit -> TestCounter member IncrementWithLock: unit -> unit member IncrementWithoutLock: unit -> unit member Count: int
 A counter object, supporting unlocked and locked increment

--------------------
new: unit -> TestCounter
val mutable count: int
val this: TestCounter
val lock: lockObject: 'Lock -> action: (unit -> 'T) -> 'T (requires reference type)
val counter: TestCounter
Multiple items
val seq: sequence: 'T seq -> 'T seq

--------------------
type 'T seq = System.Collections.Generic.IEnumerable<'T>
member TestCounter.IncrementWithoutLock: unit -> unit
 Increment the counter, unlocked
property TestCounter.Count: int with get
 Get the count
val counter2: TestCounter
member TestCounter.IncrementWithLock: unit -> unit
 Increment the counter, locked

log value

Full Usage: log value

Parameters:
    value : ^T - The input value.

Returns: ^T The natural logarithm of the input.
Modifiers: inline
Type parameters: ^T

Natural logarithm of the given number

value : ^T

The input value.

Returns: ^T

The natural logarithm of the input.

Example

 let logBase baseNumber value = (log value) / (log baseNumber)
 logBase 2.0 32.0      //  Evaluates to 5.0
 logBase 10.0 1000.0   //  Evaluates to 3.0
val logBase: baseNumber: float -> value: float -> float
val baseNumber: float
val value: float
val log: value: 'T -> 'T (requires member Log)

log10 value

Full Usage: log10 value

Parameters:
    value : ^T - The input value.

Returns: ^T The logarithm to base 10 of the input.
Modifiers: inline
Type parameters: ^T

Logarithm to base 10 of the given number

value : ^T

The input value.

Returns: ^T

The logarithm to base 10 of the input.

Example

 log10 1000.0    //  Evaluates to 3.0
 log10 100000.0  //  Evaluates to 5.0
 log10 0.0001    //  Evaluates to -4.0
 log10 -20.0     //  Evaluates to nan
val log10: value: 'T -> 'T (requires member Log10)

max e1 e2

Full Usage: max e1 e2

Parameters:
    e1 : 'T - The first value.
    e2 : 'T - The second value.

Returns: 'T The maximum value.
Modifiers: inline
Type parameters: 'T

Maximum based on generic comparison

e1 : 'T

The first value.

e2 : 'T

The second value.

Returns: 'T

The maximum value.

Example

  max 1 2             //  Evaluates to 2
  max [1;2;3] [1;2;4] //  Evaluates to [1;2;4]
  max "zoo" "alpha"   //  Evaluates to "zoo"
val max: e1: 'T -> e2: 'T -> 'T (requires comparison)

methodhandleof arg1

Full Usage: methodhandleof arg1

Parameters:
    arg0 : 'T -> 'TResult

Returns: RuntimeMethodHandle
An internal, library-only compiler intrinsic for compile-time 
 generation of a RuntimeMethodHandle.
arg0 : 'T -> 'TResult
Returns: RuntimeMethodHandle

min e1 e2

Full Usage: min e1 e2

Parameters:
    e1 : 'T - The first value.
    e2 : 'T - The second value.

Returns: 'T The minimum value.
Modifiers: inline
Type parameters: 'T

Minimum based on generic comparison

e1 : 'T

The first value.

e2 : 'T

The second value.

Returns: 'T

The minimum value.

Example

  min 1 2             //  Evaluates to 1
  min [1;2;3] [1;2;4] //  Evaluates to [1;2;3]
  min "zoo" "alpha"   //  Evaluates to "alpha"
val min: e1: 'T -> e2: 'T -> 'T (requires comparison)

nameof arg1

Full Usage: nameof arg1

Parameters:
    arg0 : 'T

Returns: string
Modifiers: inline
Type parameters: 'T

Returns the name of the given symbol.

arg0 : 'T
Returns: string
Example

 let myVariableName = "This value doesn't matter"
 nameof(myVariableName)   //  Evaluates to "myVariableName"
val myVariableName: string
val nameof: 'T -> string

nan

Full Usage: nan

Returns: float

Equivalent to Double.NaN

Returns: float

nanf

Full Usage: nanf

Returns: float32

Equivalent to Single.NaN

Returns: float32

nativeint value

Full Usage: nativeint value

Parameters:
    value : ^T - The input value.

Returns: nativeint The converted nativeint
Modifiers: inline
Type parameters: ^T

Converts the argument to signed native integer. This is a direct conversion for all primitive numeric types. Otherwise the operation requires an appropriate static conversion method on the input type.

value : ^T

The input value.

Returns: nativeint

The converted nativeint

Example

 nativeint 'A'  // evaluates to 65n
 nativeint 0xff // evaluates to 255n
 nativeint -10  // evaluates to -10n
Multiple items
val nativeint: value: 'T -> nativeint (requires member op_Explicit)

--------------------
type nativeint = System.IntPtr

--------------------
type nativeint<'Measure> = nativeint

nullArg argumentName

Full Usage: nullArg argumentName

Parameters:
    argumentName : string - The argument name.

Returns: 'T Never returns.
Modifiers: inline
Type parameters: 'T

Throw a ArgumentNullException exception

argumentName : string

The argument name.

Returns: 'T

Never returns.

Example

 let fullName firstName lastName = 
     if isNull firstName then nullArg (nameof(firstName))
     if isNull lastName then nullArg (nameof(lastName))
     firstName + " " + lastName
   
   fullName null "Jones"  // Throws System.ArgumentNullException: Value cannot be null. (Parameter 'firstName')
val fullName: firstName: string -> lastName: string -> string
val firstName: string
val lastName: string
val isNull: value: 'T -> bool (requires 'T: null)
val nullArg: argumentName: string -> 'T
val nameof: 'T -> string

pown x n

Full Usage: pown x n

Parameters:
    x : ^T - The input base.
    n : int - The input exponent.

Returns: ^T The base raised to the exponent.
Modifiers: inline
Type parameters: ^T

Overloaded power operator. If n > 0 then equivalent to x*...*x for n occurrences of x.

x : ^T

The input base.

n : int

The input exponent.

Returns: ^T

The base raised to the exponent.

Example

 pown 2.0 3 // evaluates to 8.0
val pown: x: 'T -> n: int -> 'T (requires member One and member ( * ) and member (/))

raise exn

Full Usage: raise exn

Parameters:
Returns: 'T The result value.
Modifiers: inline
Type parameters: 'T

Raises an exception

exn : Exception

The exception to raise.

Returns: 'T

The result value.

Example

 open System.IO
 exception FileNotFoundException of string
 
 let readFile (fileName: string) = 
     if not (File.Exists(fileName)) then
         raise(FileNotFoundException(fileName))
     File.ReadAllText(fileName)
 
 readFile "/this-file-doest-exist"
namespace System
namespace System.IO
exception FileNotFoundException of string
Multiple items
val string: value: 'T -> string

--------------------
type string = System.String
val readFile: fileName: string -> string
val fileName: string
type File = static member AppendAllBytes: path: string * bytes: byte array -> unit static member AppendAllBytesAsync: path: string * bytes: byte array * ?cancellationToken: CancellationToken -> Task static member AppendAllLines: path: string * contents: IEnumerable<string> -> unit + 1 overload static member AppendAllLinesAsync: path: string * contents: IEnumerable<string> * encoding: Encoding * ?cancellationToken: CancellationToken -> Task + 1 overload static member AppendAllText: path: string * contents: string -> unit + 1 overload static member AppendAllTextAsync: path: string * contents: string * encoding: Encoding * ?cancellationToken: CancellationToken -> Task + 1 overload static member AppendText: path: string -> StreamWriter static member Copy: sourceFileName: string * destFileName: string -> unit + 1 overload static member Create: path: string -> FileStream + 2 overloads static member CreateSymbolicLink: path: string * pathToTarget: string -> FileSystemInfo ...
<summary>Provides static methods for the creation, copying, deletion, moving, and opening of a single file, and aids in the creation of <see cref="T:System.IO.FileStream" /> objects.</summary>
File.Exists(path: string) : bool
val raise: exn: System.Exception -> 'T
File.ReadAllText(path: string) : string
File.ReadAllText(path: string, encoding: System.Text.Encoding) : string
When executed, raises a FileNotFoundException.

ref value

Full Usage: ref value

Parameters:
    value : 'T - The value to contain in the cell.

Returns: 'T ref The created reference cell.

Create a mutable reference cell

value : 'T

The value to contain in the cell.

Returns: 'T ref

The created reference cell.

Example

 let count = ref 0   // Creates a reference cell object with a mutable Value property
 count.Value         // Evaluates to 0
 count.Value <- 1    // Updates the value
 count.Value         // Evaluates to 1
val count: int ref
Multiple items
val ref: value: 'T -> 'T ref

--------------------
type 'T ref = Ref<'T>
property Ref.Value: int with get, set

reraise ()

Full Usage: reraise ()

Parameters:
Returns: 'T The result value.
Modifiers: inline
Type parameters: 'T

Rethrows an exception. This should only be used when handling an exception

() : unit
Returns: 'T

The result value.

Example

 let readFile (fileName: string) = 
   try
     File.ReadAllText(fileName)
   with ex ->
     eprintfn "Couldn't read %s" fileName
     reraise()
   
 readFile "/this-file-doest-exist"  
 //  Prints the message to stderr
 //  Throws a System.IO.FileNotFoundException
val readFile: fileName: string -> 'a
val fileName: string
Multiple items
val string: value: 'T -> string

--------------------
type string = System.String
val ex: exn
val eprintfn: format: Printf.TextWriterFormat<'T> -> 'T
val reraise: unit -> 'T

round value

Full Usage: round value

Parameters:
    value : ^T - The input value.

Returns: ^T The nearest integer to the input value.
Modifiers: inline
Type parameters: ^T

Round the given number

value : ^T

The input value.

Returns: ^T

The nearest integer to the input value.

Example

 round 3.49    //  Evaluates to 3.0
 round -3.49   //  Evaluates to -3.0
 round 3.5     //  Evaluates to 4.0
 round -3.5    //  Evaluates to -4.0
val round: value: 'T -> 'T (requires member Round)

sbyte value

Full Usage: sbyte value

Parameters:
    value : ^T - The input value.

Returns: sbyte The converted sbyte
Modifiers: inline
Type parameters: ^T

Converts the argument to signed byte. This is a direct conversion for all primitive numeric types. For strings, the input is converted using SByte.Parse() with InvariantCulture settings. Otherwise the operation requires an appropriate static conversion method on the input type.

value : ^T

The input value.

Returns: sbyte

The converted sbyte

Example

 sbyte 'A'  // evaluates to 65y
 sbyte 0xff // evaluates to -1y
 sbyte -10  // evaluates to -10y
Multiple items
val sbyte: value: 'T -> sbyte (requires member op_Explicit)

--------------------
type sbyte = System.SByte

--------------------
type sbyte<'Measure> = sbyte

seq sequence

Full Usage: seq sequence

Parameters:
    sequence : 'T seq - The input sequence.

Returns: 'T seq The result sequence.

Builds a sequence using sequence expression syntax

sequence : 'T seq

The input sequence.

Returns: 'T seq

The result sequence.

Example

 seq { for i in 0..10 do yield (i, i*i) }
Multiple items
val seq: sequence: 'T seq -> 'T seq

--------------------
type 'T seq = System.Collections.Generic.IEnumerable<'T>
val i: int

sign value

Full Usage: sign value

Parameters:
    value : ^T - The input value.

Returns: int -1, 0, or 1 depending on the sign of the input.
Modifiers: inline
Type parameters: ^T

Sign of the given number

value : ^T

The input value.

Returns: int

-1, 0, or 1 depending on the sign of the input.

Example

 sign -12.0    //  Evaluates to -1
 sign 43       //  Evaluates to 1
val sign: value: 'T -> int (requires member Sign)

sin value

Full Usage: sin value

Parameters:
    value : ^T - The input value.

Returns: ^T The sine of the input.
Modifiers: inline
Type parameters: ^T

Sine of the given number

value : ^T

The input value.

Returns: ^T

The sine of the input.

Example

 sin (0.0 * System.Math.PI) // evaluates to 0.0
 sin (0.5 * System.Math.PI) // evaluates to 1.0
 sin (1.0 * System.Math.PI) // evaluates to 1.224646799e-16
val sin: value: 'T -> 'T (requires member Sin)
namespace System
type Math = static member Abs: value: decimal -> decimal + 7 overloads static member Acos: d: float -> float static member Acosh: d: float -> float static member Asin: d: float -> float static member Asinh: d: float -> float static member Atan: d: float -> float static member Atan2: y: float * x: float -> float static member Atanh: d: float -> float static member BigMul: a: int * b: int -> int64 + 2 overloads static member BitDecrement: x: float -> float ...
<summary>Provides constants and static methods for trigonometric, logarithmic, and other common mathematical functions.</summary>
field System.Math.PI: float = 3.14159265359
<summary>Represents the ratio of the circumference of a circle to its diameter, specified by the constant, π.</summary>

sinh value

Full Usage: sinh value

Parameters:
    value : ^T - The input value.

Returns: ^T The hyperbolic sine of the input.
Modifiers: inline
Type parameters: ^T

Hyperbolic sine of the given number

value : ^T

The input value.

Returns: ^T

The hyperbolic sine of the input.

Example

 sinh -1.0 // evaluates to -1.175201194
 sinh 0.0  // evaluates to 0.0
 sinh 1.0  // evaluates to 1.175201194
val sinh: value: 'T -> 'T (requires member Sinh)

sizeof

Full Usage: sizeof

Returns: int
Modifiers: inline
Type parameters: 'T

Returns the internal size of a type in bytes. For example, sizeof<int> returns 4.

Returns: int
Example

 sizeof<bool>                   //  Evaluates to 1
 sizeof<byte>                   //  Evaluates to 1
 sizeof<int>                    //  Evaluates to 4
 sizeof<double>                 //  Evaluates to 8
 sizeof<struct(byte * byte)>    //  Evaluates to 2
 sizeof<nativeint>              //  Evaluates to 4 or 8 (32-bit or 64-bit) depending on your platform
val sizeof<'T> : int
type bool = System.Boolean
Multiple items
val byte: value: 'T -> byte (requires member op_Explicit)

--------------------
type byte = System.Byte

--------------------
type byte<'Measure> = byte
Multiple items
val int: value: 'T -> int (requires member op_Explicit)

--------------------
type int = int32

--------------------
type int<'Measure> = int
Multiple items
val double: value: 'T -> double (requires member op_Explicit)

--------------------
type double = System.Double

--------------------
type double<'Measure> = float<'Measure>
Multiple items
val nativeint: value: 'T -> nativeint (requires member op_Explicit)

--------------------
type nativeint = System.IntPtr

--------------------
type nativeint<'Measure> = nativeint

snd tuple

Full Usage: snd tuple

Parameters:
    tuple : 'T1 * 'T2 - The input tuple.

Returns: 'T2 The second value.
Modifiers: inline
Type parameters: 'T1, 'T2

Return the second element of a tuple, snd (a,b) = b.

tuple : 'T1 * 'T2

The input tuple.

Returns: 'T2

The second value.

Example

 snd ("first", 2)  //  Evaluates to 2
val snd: tuple: ('T1 * 'T2) -> 'T2

sqrt value

Full Usage: sqrt value

Parameters:
    value : ^T - The input value.

Returns: ^U The square root of the input.
Modifiers: inline
Type parameters: ^T, ^U

Square root of the given number

value : ^T

The input value.

Returns: ^U

The square root of the input.

Example

 sqrt 2.0  //  Evaluates to 1.414213562
 sqrt 100.0  //  Evaluates to 10.0
val sqrt: value: 'T -> 'U (requires member Sqrt)

stderr

Full Usage: stderr

Returns: TextWriter

Reads the value of the property Console.Error.

Returns: TextWriter

stdin

Full Usage: stdin

Returns: TextReader

Reads the value of the property Console.In.

Returns: TextReader

stdout

Full Usage: stdout

Returns: TextWriter

Reads the value of the property Console.Out.

Returns: TextWriter

string value

Full Usage: string value

Parameters:
    value : 'T - The input value.

Returns: string The converted string.
Modifiers: inline
Type parameters: 'T

Converts the argument to a string using ToString.

For standard integer and floating point values and any type that implements IFormattableToString conversion uses CultureInfo.InvariantCulture.

value : 'T

The input value.

Returns: string

The converted string.

Example

 string 'A'  // evaluates to "A"
 string 0xff // evaluates to "255"
 string -10  // evaluates to "-10"
Multiple items
val string: value: 'T -> string

--------------------
type string = System.String

tan value

Full Usage: tan value

Parameters:
    value : ^T - The input value.

Returns: ^T The tangent of the input.
Modifiers: inline
Type parameters: ^T

Tangent of the given number

value : ^T

The input value.

Returns: ^T

The tangent of the input.

Example

 tan (-0.5 * System.Math.PI) // evaluates to -1.633123935e+16
 tan (0.0 * System.Math.PI)  // evaluates to 0.0
 tan (0.5 * System.Math.PI)  // evaluates to 1.633123935e+16
val tan: value: 'T -> 'T (requires member Tan)
namespace System
type Math = static member Abs: value: decimal -> decimal + 7 overloads static member Acos: d: float -> float static member Acosh: d: float -> float static member Asin: d: float -> float static member Asinh: d: float -> float static member Atan: d: float -> float static member Atan2: y: float * x: float -> float static member Atanh: d: float -> float static member BigMul: a: int * b: int -> int64 + 2 overloads static member BitDecrement: x: float -> float ...
<summary>Provides constants and static methods for trigonometric, logarithmic, and other common mathematical functions.</summary>
field System.Math.PI: float = 3.14159265359
<summary>Represents the ratio of the circumference of a circle to its diameter, specified by the constant, π.</summary>

tanh value

Full Usage: tanh value

Parameters:
    value : ^T - The input value.

Returns: ^T The hyperbolic tangent of the input.
Modifiers: inline
Type parameters: ^T

Hyperbolic tangent of the given number

value : ^T

The input value.

Returns: ^T

The hyperbolic tangent of the input.

Example

 tanh -1.0 // evaluates to -0.761594156
 tanh 0.0  // evaluates to 0.0
 tanh 1.0  // evaluates to 0.761594156
val tanh: value: 'T -> 'T (requires member Tanh)

truncate value

Full Usage: truncate value

Parameters:
    value : ^T - The input value.

Returns: ^T The truncated value.
Modifiers: inline
Type parameters: ^T

Overloaded truncate operator.

value : ^T

The input value.

Returns: ^T

The truncated value.

Example

 truncate 23.92 // evaluates to 23.0
 truncate 23.92f // evaluates to 23.0f
val truncate: value: 'T -> 'T (requires member Truncate)

tryUnbox value

Full Usage: tryUnbox value

Parameters:
    value : obj - The boxed value.

Returns: 'T option The unboxed result as an option.
Modifiers: inline
Type parameters: 'T

Try to unbox a strongly typed value.

value : obj

The boxed value.

Returns: 'T option

The unboxed result as an option.

Example

 let x: int = 123
 let obj1 = box x    //  obj1 is a generic object type
 tryUnbox<int> obj1     //  Evaluates to Some(123)
 tryUnbox<double> obj1  //  Evaluates to None
val x: int
Multiple items
val int: value: 'T -> int (requires member op_Explicit)

--------------------
type int = int32

--------------------
type int<'Measure> = int
val obj1: obj
val box: value: 'T -> obj
val tryUnbox: value: obj -> 'T option
Multiple items
val double: value: 'T -> double (requires member op_Explicit)

--------------------
type double = System.Double

--------------------
type double<'Measure> = float<'Measure>

typedefof

Full Usage: typedefof

Returns: Type
Modifiers: inline
Type parameters: 'T

Generate a System.Type representation for a type definition. If the input type is a generic type instantiation then return the generic type definition associated with all such instantiations.

Returns: Type
Example

 typeof<int list;>     // Evaluates to Microsoft.FSharp.Collections.FSharpList`1[System.Int32]
 typedefof<int list;>  // Evaluates to Microsoft.FSharp.Collections.FSharpList`1[T]        ///
val typeof<'T> : System.Type
Multiple items
val int: value: 'T -> int (requires member op_Explicit)

--------------------
type int = int32

--------------------
type int<'Measure> = int
type 'T list = List<'T>
val typedefof<'T> : System.Type

typeof

Full Usage: typeof

Returns: Type
Modifiers: inline
Type parameters: 'T

Generate a System.Type runtime representation of a static type.

Returns: Type
Example

 let t = typeof<int>  // Gets the System.Type
 t.FullName                 // Evaluates to "System.Int32"
val t: System.Type
val typeof<'T> : System.Type
Multiple items
val int: value: 'T -> int (requires member op_Explicit)

--------------------
type int = int32

--------------------
type int<'Measure> = int
property System.Type.FullName: string with get

uint value

Full Usage: uint value

Parameters:
    value : ^T - The input value.

Returns: uint The converted int
Modifiers: inline
Type parameters: ^T

Converts the argument to an unsigned 32-bit integer. This is a direct conversion for all primitive numeric types. For strings, the input is converted using UInt32.Parse() with InvariantCulture settings. Otherwise the operation requires an appropriate static conversion method on the input type.

value : ^T

The input value.

Returns: uint

The converted int

Example

 uint 'A'  // evaluates to 65u
 uint 0xff // evaluates to 255u
 uint -10  // evaluates to 4294967286u
Multiple items
val uint: value: 'T -> uint (requires member op_Explicit)

--------------------
type uint = uint32

--------------------
type uint<'Measure> = uint

uint16 value

Full Usage: uint16 value

Parameters:
    value : ^T - The input value.

Returns: uint16 The converted uint16
Modifiers: inline
Type parameters: ^T

Converts the argument to unsigned 16-bit integer. This is a direct conversion for all primitive numeric types. For strings, the input is converted using UInt16.Parse() with InvariantCulture settings. Otherwise the operation requires an appropriate static conversion method on the input type.

value : ^T

The input value.

Returns: uint16

The converted uint16

Example

 uint16 'A'  // evaluates to 65us
 uint16 0xff // evaluates to 255s
 uint16 -10  // evaluates to 65526us
Multiple items
val uint16: value: 'T -> uint16 (requires member op_Explicit)

--------------------
type uint16 = System.UInt16

--------------------
type uint16<'Measure> = uint16

uint32 value

Full Usage: uint32 value

Parameters:
    value : ^T - The input value.

Returns: uint32 The converted uint32
Modifiers: inline
Type parameters: ^T

Converts the argument to unsigned 32-bit integer. This is a direct conversion for all primitive numeric types. For strings, the input is converted using UInt32.Parse() with InvariantCulture settings. Otherwise the operation requires an appropriate static conversion method on the input type.

value : ^T

The input value.

Returns: uint32

The converted uint32

Example

 uint32 'A'  // evaluates to 65u
 uint32 0xff // evaluates to 255u
 uint32 -10  // evaluates to 4294967286u
Multiple items
val uint32: value: 'T -> uint32 (requires member op_Explicit)

--------------------
type uint32 = System.UInt32

--------------------
type uint32<'Measure> = uint<'Measure>

uint64 value

Full Usage: uint64 value

Parameters:
    value : ^T - The input value.

Returns: uint64 The converted uint64
Modifiers: inline
Type parameters: ^T

Converts the argument to unsigned 64-bit integer. This is a direct conversion for all primitive numeric types. For strings, the input is converted using UInt64.Parse() with InvariantCulture settings. Otherwise the operation requires an appropriate static conversion method on the input type.

value : ^T

The input value.

Returns: uint64

The converted uint64

Example

 uint64 'A'  // evaluates to 65UL
 uint64 0xff // evaluates to 255UL
 uint64 -10  // evaluates to 18446744073709551606UL
Multiple items
val uint64: value: 'T -> uint64 (requires member op_Explicit)

--------------------
type uint64 = System.UInt64

--------------------
type uint64<'Measure> = uint64

unativeint value

Full Usage: unativeint value

Parameters:
    value : ^T - The input value.

Returns: unativeint The converted unativeint
Modifiers: inline
Type parameters: ^T

Converts the argument to unsigned native integer using a direct conversion for all primitive numeric types. Otherwise the operation requires an appropriate static conversion method on the input type.

value : ^T

The input value.

Returns: unativeint

The converted unativeint

Example

 unativeint 'A'  // evaluates to 65un
 unativeint 0xff // evaluates to 255un
 unativeint -10  // evaluates to 18446744073709551606un
Multiple items
val unativeint: value: 'T -> unativeint (requires member op_Explicit)

--------------------
type unativeint = System.UIntPtr

--------------------
type unativeint<'Measure> = unativeint

unbox value

Full Usage: unbox value

Parameters:
    value : obj - The boxed value.

Returns: 'T The unboxed result.
Modifiers: inline
Type parameters: 'T

Unbox a strongly typed value.

value : obj

The boxed value.

Returns: 'T

The unboxed result.

Example

 let x: int = 123
 let obj1 = box x    //  obj1 is a generic object type
 unbox<int> obj1     //  Evaluates to 123 (int)
 unbox<double> obj1  //  Throws System.InvalidCastException
val x: int
Multiple items
val int: value: 'T -> int (requires member op_Explicit)

--------------------
type int = int32

--------------------
type int<'Measure> = int
val obj1: obj
val box: value: 'T -> obj
val unbox: value: obj -> 'T
Multiple items
val double: value: 'T -> double (requires member op_Explicit)

--------------------
type double = System.Double

--------------------
type double<'Measure> = float<'Measure>

using resource action

Full Usage: using resource action

Parameters:
    resource : 'T - The resource to be disposed after action is called.
    action : 'T -> 'U - The action that accepts the resource.

Returns: 'U The resulting value.

Clean up resources associated with the input object after the completion of the given function. Cleanup occurs even when an exception is raised by the protected code.

resource : 'T

The resource to be disposed after action is called.

action : 'T -> 'U

The action that accepts the resource.

Returns: 'U

The resulting value.

Example

The following code appends 10 lines to test.txt, then closes the StreamWriter when finished.

 open System.IO
 
 using (File.AppendText "test.txt") (fun writer ->
     for i in 1 .. 10 do
         writer.WriteLine("Hello World {0}", i))
namespace System
namespace System.IO
val using: resource: 'T -> action: ('T -> 'U) -> 'U (requires 'T :> System.IDisposable)
type File = static member AppendAllBytes: path: string * bytes: byte array -> unit static member AppendAllBytesAsync: path: string * bytes: byte array * ?cancellationToken: CancellationToken -> Task static member AppendAllLines: path: string * contents: IEnumerable<string> -> unit + 1 overload static member AppendAllLinesAsync: path: string * contents: IEnumerable<string> * encoding: Encoding * ?cancellationToken: CancellationToken -> Task + 1 overload static member AppendAllText: path: string * contents: string -> unit + 1 overload static member AppendAllTextAsync: path: string * contents: string * encoding: Encoding * ?cancellationToken: CancellationToken -> Task + 1 overload static member AppendText: path: string -> StreamWriter static member Copy: sourceFileName: string * destFileName: string -> unit + 1 overload static member Create: path: string -> FileStream + 2 overloads static member CreateSymbolicLink: path: string * pathToTarget: string -> FileSystemInfo ...
<summary>Provides static methods for the creation, copying, deletion, moving, and opening of a single file, and aids in the creation of <see cref="T:System.IO.FileStream" /> objects.</summary>
File.AppendText(path: string) : StreamWriter
val writer: StreamWriter
val i: int32
TextWriter.WriteLine() : unit
   (+0 other overloads)
TextWriter.WriteLine(value: uint64) : unit
   (+0 other overloads)
TextWriter.WriteLine(value: uint32) : unit
   (+0 other overloads)
TextWriter.WriteLine(value: System.Text.StringBuilder) : unit
   (+0 other overloads)
TextWriter.WriteLine(value: float32) : unit
   (+0 other overloads)
TextWriter.WriteLine(value: obj) : unit
   (+0 other overloads)
TextWriter.WriteLine(value: int64) : unit
   (+0 other overloads)
TextWriter.WriteLine(value: int) : unit
   (+0 other overloads)
TextWriter.WriteLine(value: float) : unit
   (+0 other overloads)
TextWriter.WriteLine(value: decimal) : unit
   (+0 other overloads)

Active patterns

Active pattern Description

(|Failure|_|) error

Full Usage: (|Failure|_|) error

Parameters:
    error : exn - The input exception.

Returns: string option A string option.

Matches Exception objects whose runtime type is precisely Exception

error : exn

The input exception.

Returns: string option

A string option.

(|KeyValue|) keyValuePair

Full Usage: (|KeyValue|) keyValuePair

Parameters:
    keyValuePair : KeyValuePair<'Key, 'Value> - The input key/value pair.

Returns: 'Key * 'Value A tuple containing the key and value.

An active pattern to match values of type KeyValuePair

keyValuePair : KeyValuePair<'Key, 'Value>

The input key/value pair.

Returns: 'Key * 'Value

A tuple containing the key and value.

Example

 let kv = System.Collections.Generic.KeyValuePair(42, "the answer")
 match kv with // evaluates to "found it"
 | KeyValue (42, v) -> "found it"
 | KeyValue (k, v) -> "keep waiting"
val kv: System.Collections.Generic.KeyValuePair<int,string>
namespace System
namespace System.Collections
namespace System.Collections.Generic
Multiple items
[<Struct>] type KeyValuePair<'TKey,'TValue> = new: key: 'TKey * value: 'TValue -> unit member Deconstruct: key: byref<'TKey> * value: byref<'TValue> -> unit member ToString: unit -> string member Key: 'TKey member Value: 'TValue
<summary>Defines a key/value pair that can be set or retrieved.</summary>
<typeparam name="TKey">The type of the key.</typeparam>
<typeparam name="TValue">The type of the value.</typeparam>


--------------------
type KeyValuePair = static member Create<'TKey,'TValue> : key: 'TKey * value: 'TValue -> KeyValuePair<'TKey,'TValue>
<summary>Creates instances of the <see cref="T:System.Collections.Generic.KeyValuePair`2" /> struct.</summary>

--------------------
System.Collections.Generic.KeyValuePair ()
System.Collections.Generic.KeyValuePair(key: 'TKey, value: 'TValue) : System.Collections.Generic.KeyValuePair<'TKey,'TValue>
active recognizer KeyValue: System.Collections.Generic.KeyValuePair<'Key,'Value> -> 'Key * 'Value
val v: string
val k: int

Type something to start searching.