开发者

how to use c# struct from f#

开发者 https://www.devze.com 2023-02-07 23:22 出处:网络
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 <-

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 <- o开发者_JAVA百科perator...is there another way?


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.


Do you require something like that?

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

精彩评论

暂无评论...
验证码 换一张
取 消