how to use c# struct from f#

送分小仙女□ 提交于 2019-12-12 04:21:58

问题


what's the syntax for using a c# struct in f#? how do i assign it's fields values?

thanks!

update:

looks like i can declare the variable itself mutable and then set it's fields using the <- operator...is there another way?


回答1:


looks like i can declare the variable itself mutable and then set it's fields using the <- operator...is there another way?

This is the correct thing to do.

let mutable someStruct = CallSomething()
someStruct.Field1 <- 42
// etc.



回答2:


Do you require something like that?

open System.Drawing
let point = Point(X = 1, Y = 3)


来源:https://stackoverflow.com/questions/4855766/how-to-use-c-sharp-struct-from-f

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!