F# 在F中使用关键字作为成员名称#

F# 在F中使用关键字作为成员名称#,f#,F#,F#是否允许使用关键字名称定义成员 type Fruit = val type : string 在C#中,可以使用@: class Fruit { string @type; } 使用双反勾号: type Fruit = val ``type`` : string 请注意,这还允许您使用其他奇数名称,例如带有空格的名称或带有.dots的名称。奇数名称出现在其他语言使用的公共api中时会引起问题。

F#是否允许使用关键字名称定义成员

type Fruit =
  val type : string
在C#中,可以使用@:

class Fruit 
{
    string @type;
}
使用双反勾号:

type Fruit =
    val ``type`` : string

请注意,这还允许您使用其他奇数名称,例如带有空格的
名称
或带有.dots的
名称。奇数名称出现在其他语言使用的公共api中时会引起问题。