How to define type member constant in F# ?

Posted by zproxy on Stack Overflow See other posts from Stack Overflow or by zproxy
Published on 2010-03-08T07:46:39Z Indexed on 2010/03/08 7:51 UTC
Read the original article Hit count: 231

Filed under:
|
|

In C# one can define a type member constant like this:

class Foo { public const int Bar = 600; }

The IL shall looks like this.

.field public static literal int32 Bar = int32(600)

How can I do the same within Visual F# / FSharp?

I tried this to no avail:

[<Sealed>]
 type Foo() =

    [<Literal>]
    let Bar = 600

© Stack Overflow or respective owner

Related posts about fsharp

Related posts about .NET