in C# it is possible to apply an attribute to the return of a method:
[return: DynamicAttribute]
public object Xyz() {
return new ExpandoObject();
}
Is this possible in F#?
Background:
I would like a method of a library written in F# which will be consumed in a language like C# to return "dynamic" from a method. If I look into a similarly defined method compiled from C# it seems like the return type is object and the DynamicAttribute is applied to the return value of the object.
Sure, you can apply a similar attribute target for the return value.
let SomeFunc x : [<return: SomeAttribute>] SomeType =
SomeOperation x
See the table of how to specify attribute targets at the end of this MSDN page.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With