At first I thought it would be close to what you wanted:
type Foo<'a> private() = static member Blah (a:'a) = printfn "%A" a
To be like the pre C # 2.0 idiom of being realistic only through reflection or the class itself (which I hope would not have done that).
however, this compiled to:
[Serializable, CompilationMapping(SourceConstructFlags.ObjectType)] public class Foo<a> { internal Foo() {...} public static void Blah(aa) {...} }
This means that other classes inside the f # assembly could instantiate.
However, the ever reported Brian pointed out that the f # compiler respects this private parameter, despite the CLR type, which means that the only way to create an instance will be through reflection or using something like the InternalsVisibleTo attribute.
This may be acceptable for your needs ...
ShuggyCoUk
source share