// Collection of code snippets by Arne Vajhøj // (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) using System; using System.IO; using System.Runtime.Serialization.Formatters.Binary; using SomeLib; namespace Write { public class Program { public static void Main(string[] args) { SomeClass o = new SomeClass { S = "ABC" }; BinaryFormatter binser = new BinaryFormatter(); using(Stream f = new FileStream(@"C:\work\o.bin", FileMode.Create, FileAccess.Write)) { binser.Serialize(f, o); } } } }