Home » F# Type Extensions

F# Type Extensions

by Online Tutorials Library

F# Type Extensions

Type extension allows you to add new members to your previously defined object type.

The syntax of Type Extensions in F# language is given below:

F# Type Extension Example

In the following example, we are adding new method to previous defined class. Here, we are calling methods by using a single object of the class.

Output:

Class before extension  Class after extension  

You may also like