I want to do some work in a non-primary constructor before calling the primary constructor, e.g. something like this:
type Foo(a:int,b:int) =
let a = a
let b = b
new(s:string) =
//...work here (intermediate let bindings)
let _a = ...
let _b = ...
Foo(_a,_b)
If possible, how can I achieve this (now that I think about it, I’m not even sure if this can be done in C#, but the goal is similar to how you can call base constructors anywhere you like in an extending class constructor… but I don’t want to do anything so sketch, just process my arguments a bit before deferring to the primary constructor — or maybe I’ve been looking at computer screens too much today)?
I don’t know what you did but this works for me:
In addition if you want to call base constructors in a derived type and pre or post insert code, here’s the syntax FYI (beware of the braces placement):