Now we have CLIMutable to solve this problem. The screenshot for CLIMutable is below:
If you define the following F# code:
[ < CLIMutable > ]
type R =
{ X: int; Y:int }
type R2 =
{ X: int; Y:int }
then in the C# code you can do
var x = new R();
var x2 = new R(0, 2);
var y = new R2(0, 2);
// var y2 = new R2(); //does not compile
The type R has the default constructor while R2, which is not decorated with CLIMutable, does not have the default constructor.
Hopefully this 3.0 feature can make your UI work a little easier. :-)
1 comment:
This looks like a great feature. It would be nice if we could also write something like this:
mutable type R = {X:int, Y:int}
Post a Comment