Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I make the XNamespace on F#?

Tags:

xml

f#

C# Sample:

XNamespace aw = "http://www.adventure-works.com";

How does F # I write?

I try that:

let ns : XNamespace = "URI ADDRESS";;

F# Say Error

like image 404
BLUEPIXY Avatar asked Oct 15 '11 00:10

BLUEPIXY


2 Answers

F# doesn't have implicit operators, so:

let ns = XNamespace.op_Implicit "http://www.adventure-works.com"

If you use this a lot, you might want to put it in a function or operator to hide the ugliness a bit, e.g:

let inline xns n = XNamespace.op_Implicit n
let ns = xns "http://www.adventure-works.com"
like image 192
Mauricio Scheffer Avatar answered Sep 30 '22 10:09

Mauricio Scheffer


F# doesn't have implicit operators, but you can use the Get() method:

let ns = XNamespace.Get "URI ADDRESS"
like image 39
svick Avatar answered Sep 30 '22 11:09

svick