I can see that if I create a new anonymous record, eg.
let myRecord = {| SomeInteger = 5 |}
then if it's exposed to C# then I can dot into it with
var someInteger = myRecord.SomeInteger;
What about the other way round, if I have an F# function, say:
let unwrap (record : {| SomeInteger : int |}) = record.SomeInteger
and it's exposed to C#, how can I instantiate an argument for this function from C# and call it? I tried naively just placing a C# anonymous type there, ie.
var unwrapped = unwrap(new { SomeInteger = 5 });
but this didn't compile. I note in the RFC for the feature it's said that "The feature must achieve compatibility with C# anonymous objects (from C# 3.0)" but it's not specifically mentioned in which ways. Is this supported?
myRecord
. That should tell you a lot about the way in which that compatibility was realized. – Conclusivevar
and access its fields. – Haug