I think I need more information to help. How was this originally serialized out? Can you show the code?

By on 11/12/2009 1:11 PM ()

let marshall_out (os : System.IO.Stream) (x: 'a) =

let formatter = new System.Runtime.Serialization.Formatters.Binary.BinaryFormatter() in

formatter.Serialize(os, box [x]);

os.Flush()

let marshall_in (is : System.IO.Stream) =

let formatter = new System.Runtime.Serialization.Formatters.Binary.BinaryFormatter() in

let res = formatter.Deserialize(is) in

match ((unbox res) : 'a list) with

| [x] -> x

| _ -> failwith "marshall_in : expected one item."

By on 11/12/2009 1:27 PM ()

Hm. While there may be something else you can do, the only thing offhand I'm sure will work is to use a 1.9.6.2 version of F# to make a program that loads this data into memory and then re-writes it back out using some version-neutral format. BinaryFormatter is not a good choice for scenarios where the assemblies will change (in this case you're always serializing an F# list for some reason, and so each new revision of F# would potentially break this).

What kind of data do you want to store (ints, strings, records, fields of classes, ...)?

By on 11/12/2009 2:01 PM ()

I was using it to store lists and maps, and some derived structures (maps of lists).

By on 11/12/2009 2:20 PM ()

Pragmatically, while F# is still in Beta, it might make sense to just convert the lists and maps to System.Collections.Generic List and Dictionary and serialize/deserialize those ("unchanging") .Net types instead.

By on 11/12/2009 3:11 PM ()

Thanks for the advice Brian, I think that i am going to implement the 'correct' solution and store my data in a DB.

By on 11/13/2009 6:42 AM ()
IntelliFactory Offices Copyright (c) 2011-2012 IntelliFactory. All rights reserved.
Home | Products | Consulting | Trainings | Blogs | Jobs | Contact Us | Terms of Use | Privacy Policy | Cookie Policy
Built with WebSharper