Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Accessing a namespace containing .base in its name from F#

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

like image 536
em70 Avatar asked May 02 '10 21:05

em70


1 Answers

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
like image 131
Tomas Petricek Avatar answered Sep 27 '22 00:09

Tomas Petricek