Access dynamic objects in F #

I parameterize some linq queries and ended up using dynamic linq. Initially, I had problems retrieving data from the dynamic objects that he created, but I managed to extract them using FSharp. InteropDynamic, regarding the best way to parameterize linq queries, I plan to post another question. My question is:

  • This is the best way to access dynamic linq and / or dynamic objects (memory and speed?).
  • When I first use it, FSI gives me a message.

    Binding session to '..\..\packages\Dynamitey.1.0.2.0\lib\net40\Dynamitey.dll'...

What it is?

Simplified code:

 #if INTERACTIVE #r "System.Data.Linq.dll" #r @"..\packages\System.Linq.Dynamic.1.0.6\lib\net4\System.Linq.Dynamic.dll" #r @"..\packages\FSharp.Interop.Dynamic.3.0.0.0\lib\portable-net45+sl50+win\FSharp.Interop.Dynamic.dll" #r @"..\packages\Dynamitey.1.0.2.0\lib\net40\Dynamitey.dll" #endif open System.Linq open System.Linq.Dynamic open FSharp.Interop.Dynamic type Rec1 = { City:string Country:string Zip:int } let x = [{City="London";Country="UK";Zip=1029};{City="Glasgow";Country="UK";Zip=30921}; {City="London";Country="USA";Zip=90210}] let y = x.Where(fun x -> x.City ="London").Select("new(City,Zip)") [for xx in y -> (xx?City:string),(xx?Zip:int)] 

This will give me: val it : (string * int) list = [("London", 1029); ("London", 90210)] val it : (string * int) list = [("London", 1029); ("London", 90210)] as expected.

This is a good overview of using dynamic objects from F #: Accessing a dynamic object F #

+2
source share

All Articles