using System; using System.IO; using System.Collections; using System.Runtime.Serialization.Formatters.Binary; namespace BinaryFormatter { /// /// Zusammenfassung für Class1. /// class Class1 { /// /// Der Haupteinstiegspunkt für die Anwendung. /// [STAThread] static void Main(string[] args) { /* Attention: * in my case I'm using only the Deserialisation part. * I deserialize the ArrayList from a network stream. * The sending part to this stream runs on DotNet. * */ ArrayList arr = new ArrayList(); arr.Add( "1. string" ); arr.Add( "2. string" ); arr.Add( "3. string" ); MemoryStream stream = new MemoryStream(); System.Runtime.Serialization.Formatters.Binary.BinaryFormatter bf = new System.Runtime.Serialization.Formatters.Binary.BinaryFormatter(); bf.Serialize( stream, arr ); stream.Seek( 0, System.IO.SeekOrigin.Begin ); object o = bf.Deserialize( stream ); if( o is ArrayList ) { Console.WriteLine(( (ArrayList)o).ToString() ); } Console.ReadLine(); } } }