Enter the .Net field from F # when the field name is a reserved keyword

I have a structure that has a field called type

How do I access it in F #?

FROM#

 struct A { int type; } 

e #

 let a = A() let myThing = a.type //error because type is a reserved keyword 

How do I access the type A field?

+8
c # f #
source share
2 answers

You can use double A.``type`` to qualify it A.``type`` .

+5
source share

You access type as a static field. First, you need an instance of A :

 let a = A() let x = a.``type`` 
+12
source share

All Articles