问题
As the title says, I'm trying to use a class declared in a namespace which contains "base" in its name. Think of a situation like the following:
open Foo.base.Bar
In C# I'd just use @ before base but F# seems to ignore that and to think that @ is the infix operator used for list concatenation. Since the namespace belongs to a third-party library which I cannot modify, is there a way I can still access it from F#?
回答1:
In F#, you can achieve similar thing by enclosing the special name between two pairs of `` symbols. The following should do the trick:
open Foo.``base``.Bar
This is a bit more flexible than in C# - the name can contain almost anything, so you can for example define members with space in the name:
let ``some name!`` = 42
来源:https://stackoverflow.com/questions/2754970/accessing-a-namespace-containing-base-in-its-name-from-f