Skip to content

Instantly share code, notes, and snippets.

@ohlawdie
Last active February 11, 2020 22:41
Show Gist options
  • Save ohlawdie/ccdfd4a645de7549d8232bbb7ba6eee1 to your computer and use it in GitHub Desktop.
Save ohlawdie/ccdfd4a645de7549d8232bbb7ba6eee1 to your computer and use it in GitHub Desktop.
Method Syntaxes F# #FSharp
// Instance method definition.
[ attributes ]
member [inline] self-identifier.method-name parameter-list [ : return-type ] =
method-body
// Static method definition.
[ attributes ]
static member [inline] method-name parameter-list [ : return-type ] =
method-body
// Abstract method declaration or virtual dispatch slot.
[ attributes ]
abstract member method-name : type-signature
// Virtual method declaration and default implementation.
[ attributes ]
abstract member method-name : type-signature
[ attributes ]
default self-identifier.method-name parameter-list [ : return-type ] =
method-body
// Override of inherited virtual method.
[ attributes ]
override self-identifier.method-name parameter-list [ : return-type ] =
method-body
// Optional and DefaultParameterValue attributes on input parameters
[ attributes ]
[ modifier ] member [inline] self-identifier.method-name ([<Optional; DefaultParameterValue( default-value )>] input) [ : return-type ]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment