I have a struct that has a field called type
How do i access it in F#?
c#
struct A {
int type;
}
f#
let a = A()
let myThing = a.type //error because type is a reserved keyword
How do i access the type
field of A
?
You're accessing type
like a static field. First, you need an instance of A
:
let a = A()
let x = a.``type``
You can use a double backtick to qualify it A.``type``
.
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