[C# CF2.0] Sérialization binaire ?
Bonjour a tous !
Voila je suis en train de développer un logiciel sous Windows 2000/XP en C# avec le Framework 2 et je cherche à l'exporter sous Windows Mobile 5.
L'ennuis c'est que j'utilisait une classe outil pour sérializer mes objets en binaire et les recharger en mémoire.
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
| public static void BinarySerialization(object o, string file)
{
try
{
Stream stream = File.Open(file, FileMode.OpenOrCreate);
System.Runtime.Serialization.Formatters.Binary.BinaryFormatter b = new System.Runtime.Serialization.Formatters.Binary.BinaryFormatter();
b.Serialize(stream, o);
stream.Close();
}
catch (Exception e)
{
Console.WriteLine(e.ToString());
}
}
public static object BinaryDeSerialization(string file)
{
try
{
Object o = new Object();
Stream stream = File.Open(file, FileMode.Open);
System.Runtime.Serialization.Formatters.Binary.BinaryFormatter b = new System.Runtime.Serialization.Formatters.Binary.BinaryFormatter();
o = b.Deserialize(stream);
stream.Close();
return o;
}
catch (Exception e)
{
Console.WriteLine(e.ToString());
return null;
}
} |
Je me suis aperçut que System.Runtime.Serialization.Formatters.Binary.BinaryFormatter n'est pas disponible avec le CF2. Alors je voudrais savoir si il y a une alternative ?
Merci d'avance.
AlnCool