【发布时间】:2010-03-08 07:46:39
【问题描述】:
在 C# 中,可以像这样定义类型成员常量:
class Foo { public const int Bar = 600; }
IL 看起来像这样。
.field public static literal int32 Bar = int32(600)
如何在 Visual F# / FSharp 中做同样的事情?
我试过没有用:
[<Sealed>]
type Foo() =
[<Literal>]
let Bar = 600
【问题讨论】:
-
我问了这个问题 -- stackoverflow.com/questions/1834923/f-public-literal -- 克里斯史密斯表示这是不可能的。