Hi, there. By default (at the time of writing), F# doesn't add references to .NET Framework 3.5 DLLs, so you need to do this manually:
#I @"C:\Program Files\Reference Assemblies\Microsoft\Framework\v3.5"
#r "System.Core.dll"
#r "System.Xml.Linq.dll"
after which you need to import necessary namespaces:
open System.Linq
open System.Collections.Generic
open System.Xml.Linq
Now you can go with LINQ to Objects and LINQ to XML.
One more thing, F# doesn't seem to recognize (and support) extension methods (I think that's because the current version of F# was built on top of .NET Framework 2.0 instead of 3.5, correct me if I'm wrong). Therefore you cannot use dot notation to access those methods defined within Enumerable class as you can in C#. Pipeline operator (|>) can help but a bit of addition work is required. Take Enumerable.First() method as an example, you need to first define a first funcation as follows:
let first (coll: #seq<'a>) = Enumerable.First<_>(coll)
Then you can go on with you collection:
{ 1..10 } |> first
Hope that helps.
Allen Lee, C# MVP
http://allenlee.spaces.live.com/