How would I write the following C# code in F#?
namespace Shared {
public class SharedRegistry : PageRegistry {
public SharedRegistry(bool useCach
I'm not sure that I understand your question; what you've written above looks like it ought to work fine. If you're asking where to put the rest of the constructor logic, try this:
type SharedRegistry(useCache) as this =
inherit PageRegistry(useCache)
do
this.ForRequestedType().TheDefaultIsConcreteType()
// etc.
new() = SharedRegistry(true)
If you want to define each constructor individually, you can do that too:
type SharedRegistry =
inherit PageRegistry
new(useCache) as this =
{ inherit PageRegistry(useCache) } then
this.ForRequestedType().TheDefaultIsConcreteType()
// etc.
new() = SharedRegistry(true)
Or, you could use an optional argument to your main constructor:
type SharedRegistry(?useCache) as this =
inherit PageRegistry(defaultArg useCache true)
do
this.ForRequestedType().TheDefaultIsConcreteType()
// etc.