I have a base class with a constant
public class TestClassBase
{
protected const string Foo = "Bar";
}
which I can consume in C# as follows
[Trait(Foo, "")]
public class MyCSharpTestClass : TestClassBase
{
}
How do I consume it in a F# class? Foo
is not recognized by the compiler.
[<Trait(Foo, "")>]
type MyFSharpTestClass() =
inherit TestClassBase()
The error I get is: FS0267 This is not a valid constant expression or custom attribute value.
EDIT
[<Trait(Foo, "")>]
yields: FS0039 The value or constructor 'Foo' is not defined. Maybe you want one of the following: floor.
[<Trait(this.Foo, "")>]
yields FS0039 The value, namespace, type or module 'this' is not defined. Maybe you want one of the following: ThisAssembly.
[<Trait(base.Foo, "")>]
yields FS0039 The value, namespace, type or module 'base' is not defined. Maybe you want one of the following: Base.
[<Trait(TestClassBase.Foo, "")>]
yields FS0039 The field, constructor or member 'Foo' is not defined.