Quick overview of generic type support in F#
F# has generic type as the parameterized type support, just as in C#/VB, and all have the same concept and similar semantics, although F# goes further by allowing type generalizations.
For example, in F#, to declare a type that has a generic type parameter in use:
List<'t>
If the parameter is used in code, the parameter of the generic type must be filled in, such as in this example:
List<int>
In our last example, the generic type becomes specialized as int
. The List
is a sample of a concrete type that has a generic type as the type parameter. This concept is also similar to the semantics in C#/VB.
Note
Throughout this book, the types in F# that support the generic type such as F# List
, Map
, Set
, and Array
will use the same notation as F# types in the MSDN Library, although the complete compilation name may differ. For example, F# Map
type is known as FSharpMap
from outside of F#'s scope (when used in other languages such as...