.net - Serialization of ISolution - Roslyn CTP3 -


i have been experimenting roslyn in context of meta-programming, have encountered difficulties in persisting isolution or iproject objects database. here have tried serialize isolution objects byte array , object. ran class not marked serializable exception. i'm open ideas on this, if approaching in wrong way please feel free so.

update: reason need serialize these items database involves experiments genetic programming. can alter solution, or project test newly altered program , use altered program future generations if did in testing phase. unfortunately, little impractical keep these objects in memory time. power outage 1 reason persist state of these entities, there others well. don't need serialize these things bytes per se, save minimum amount of information allow me reconstruct these objects when needed. however, i'm not sure of efficient way achieve end goal.

public static object bytearraytoobject(this byte[] arrbytes)     {         memorystream serializationstream = new memorystream();         binaryformatter formatter = new binaryformatter();         serializationstream.write(arrbytes, 0, arrbytes.length);         serializationstream.seek(0l, seekorigin.begin);         return formatter.deserialize(serializationstream);     }      public static byte[] objecttobytearray(this object obj)     {         if (obj == null)         {             return null;         }         binaryformatter formatter = new binaryformatter();         memorystream serializationstream = new memorystream();         formatter.serialize(serializationstream, obj);         return serializationstream.toarray();     } 

solutions aren't serializable, , won't time soon.

for scenario, might best serializing new text of files you've changed. store diff of text if wanted save space. syntaxtrees in roslyn can serialized binary stream , back, we've discovered that's overkill scenarios. syntaxtrees have natural serialization format -- text -- , can reparse resulting text back.


Comments

Popular posts from this blog

blackberry 10 - how to add multiple markers on the google map just by url? -

php - guestbook returning database data to flash -

delphi - Dynamic file type icon -