문제

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?

도움이 되었습니까?

해결책

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)
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top