views:

481

answers:

2

I'm trying to figure out how to make static methods in a class in F#. Does anyone have any idea how to do this?

+5  A: 

Sure, just prefix the method with the static keyword. Here's an example:

type Example = class
  static member Add a b = a + b
end
Example.Add 1 2

val it : int = 3
sker
Cool thanks! (filling characters)
RCIX
+4  A: 

Don't forget the online docs!

Methods

has this info, and

F# Language Reference

is a general good starting point to find info about the language syntax.

Brian
Ypu, SOP for me is to scour the docs first to see if i can find a help there first. It averted at least one question!
RCIX