private static void SaveToDataFile(FileStream outFile) { //Serialize the app state var serializer = new DataContractSerializer(typeof(Pool)); var g = Pool.Instance; var c = new GridCell(); c.Update("test"); g.Grid[0][0].Update("change"); //Your app pool's identity should have write access to this file. serializer.WriteObject(outFile, g); }