views:

46

answers:

1

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#?

+6  A: 

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
Tomas Petricek
This is a handy feature; in F# product unit tests, we have tests named like "member this.```Adding a reference to the project correctly updates the .fsproj file```()". :)
Brian