F# Language Reference
This section is a reference to the F# language, a multi-paradigm programming language targeting the .NET platform. The F# language supports functional, object-oriented and imperative programming models.
The following table shows reference topics that provide tables of keywords, symbols and literals used as tokens in F#.
Contains links to information about all F# language keywords.
Contains a table of symbols and operators that are used in the F# language.
Describes the syntax for literal values in F# and how to specify type information for F# literals.
The following table shows reference topics available that describe language concepts.
Functions are the fundamental unit of program execution in any programming language. As in other languages, an F# function has a name, can have parameters and take arguments, and has a body. F# also supports functional programming constructs such as treating functions as values, using unnamed functions in expressions, composition of functions to form new functions, curried functions, and the implicit definition of functions by way of the partial application of function arguments.
Describes the types that are used in F# and how F# types are named and described.
Describes how the F# compiler infers the types of values, variables, parameters and return values.
Describes generic constructs in F#.
Describes inheritance, which is used to model the "is-a" relationship, or subtyping, in object-oriented programming.
Describes members of F# object types.
Describes language support for defining parameters and passing arguments to functions, methods, and properties. It includes information about how to pass by reference.
Describes how to overload arithmetic operators in a class or record type, and at the global level.
Describes support for type conversions in F#.
Describes access control in F#. Access control means declaring what clients are able to use certain program elements, such as types, methods, functions and so on.
Describes patterns, which are rules for transforming input data that are used throughout the F# language to extract compare data with a pattern, decompose data into constituent parts, or extract information from data in various ways.
Describes active patterns. Active patterns enable you to define named partitions that subdivide input data. You can use active patterns to decompose data in a customized manner for each partition.
Describes the assert expression, which is a debugging feature that you can use to test an expression. Upon failure in Debug mode, an assertion generates a system error dialog box.
Contains information about exception handling support in the F# language.
Describes attributes, which enable metadata to be applied to a programming construct.
Describes the keywords use and using, which can control the initialization and release of resources
Describes namespace support in F#. A namespace lets you organize code into areas of related functionality by enabling you to attach a name to a grouping of program elements.
Describes modules. An F# module is a grouping of F# code, such as values, types, and function values, in an F# program. Grouping code in modules helps keep related code together and helps avoid name conflicts in your program.
Describes how open works. An import declaration specifies a module or namespace whose elements you can reference without using a fully qualified name.
Describes signatures and signature files. A signature file contains information about the public signatures of a set of F# program elements, such as types, namespaces, and modules. It can be used to specify the accessibility of these program elements.
Describes support for generating documentation files for XML doc comments, also known as triple slash comments. You can produce documentation from code comments in F# just as in other .NET languages.
Describes the syntax for F# constructs when lightweight syntax is not enabled. Verbose syntax is indicated by the #light "off" directive at the top of the code file.
The following table shows reference topics available that describe types supported by the F# language.
Describes values, which are immutable quantities that have a specific type; values can be integral or floating point numbers, characters or text, lists, sequences, arrays, tuples, discriminated unions, records, class types, or function values.
Describes the fundamental primitive types that are used in the F# language. It also provides the corresponding .NET types and the minimum and maximum values for each type.
Describes the unit type, which is a type that indicates the absence of a specific value; the unit type has only a single value, which acts as a placeholder when no other value exists or is needed.
Describes strings in F#. The string type represents immutable text, as a sequence of Unicode characters. string is an alias for String in the .NET Framework.
Describes tuples, which are groupings of unnamed but ordered values of possibly different types.
An overview of the F# functional collection types, including types for arrays, lists, sequences (seq), maps, and sets.
Describes lists. A list in F# is an ordered, immutable series of elements all of the same type.
Describes the option type. An option in F# is used when a value may or may not exist. An option has an underlying type and may either hold a value of that type or it may not have a value.
Describes sequences. A sequence is a logical series of elements all of one type. Individual sequence elements are only computed if required, so the representation may be smaller than a literal element count indicates.
Describes arrays. Arrays are fixed-size, zero-based, mutable sequences of consecutive data elements, all of the same type.
Describes records. Records represent simple aggregates of named values, optionally with members.
Describes discriminated unions, which provides support for values which may be one of a variety of named cases, each with possibly different values and types.
Describes enumerations are types that have a defined set of named values. You can use them in place of literals to make code more readable and maintainable.
Describes reference cells, which are storage locations that enable you to create mutable variables with reference semantics.
Describes type abbreviations, which are alternate names for types.
Describes classes, which are types that represent objects that can have properties, methods, and events.
Describes structures, which are compact object types that can be more efficient than a class for types that have a small amount of data and simple behavior.
Describes interfaces, which specify sets of related members that other classes implement.
Describes abstract classes, which are classes that leave some or all members unimplemented, so that implementations can be provided by derived classes.
Describes type extensions, which let you add new members to a previously defined object type.
Describes flexible types. A flexible type annotation is an indication that a parameter, variable or value has a type that is compatible with type specified, where compatibility is determined by position in an object-oriented hierarchy of classes or interfaces.
Describes delegates, which represent a function call as an object.
Describes units of measure. Floating point values in F# can have associated units of measure, which are typically used to indicate length, volume, mass, and so on.
Describes type provides and provides links to walkthroughs on using the built-in type providers to access databases and web services.
The following table lists topics that describe F# expressions.
Describes the if...then...else expression, which runs different branches of code and also evaluates to a different value depending on the Boolean expression given.
Describes the match expression, which provides branching control that is based on the comparison of an expression with a set of patterns.
Describes the for...to expression, which is used to iterate in a loop over a range of values of a loop variable.
Describes the for...in expression, a looping construct that is used to iterate over the matches of a pattern in an enumerable collection such as a range expression, sequence, list, array, or other construct that supports enumeration.
Describes the while...do expression, which is used to perform iterative execution (looping) while a specified test condition is true.
Describes object expressions, which are expressions that create new instances of a dynamically created, anonymous object type that is based on an existing base type, interface, or set of interfaces.
Describes lazy computations, which are computations that are not evaluated immediately, but are instead evaluated when the result is actually needed.
Describes computation expressions in F#, which provide a convenient syntax for writing computations that can be sequenced and combined using control flow constructs and bindings. They can be used to provide a convenient syntax for monads, a functional programming feature that can be used to manage data, control and side effects in functional programs. One type of computation expression, the asynchronous workflow, provides support for asynchronous and parallel computations. For more information, see Asynchronous Workflows (F#).
Describes asynchronous workflows, a language feature that lets you write asynchronous code in a way that is very close to the way you would naturally write synchronous code.
Describes code quotations, a language feature that enables you to generate and work with F# code expressions programmatically.
Describes query expressions, a language feature that implements LINQ for F# and enables you to write queries against a data source or enumerable collection.
The following table lists topics that describe special compiler-supported constructs.
Describes processor directives and compiler directives.
Describes the identifiers __LINE__, __SOURCE_DIRECTORY__ and __SOURCE_FILE__, which are built-in values that enable you to access the source line number, directory and file name in your code.