protected LayerCollection(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { if (info == null) { throw new System.ArgumentNullException("info"); } _layers = new System.Collections.ArrayList(); object[] layers = BinarySerializer.DeserializeObjectArray((byte[])info.GetValue(SerializationNames.LayerCollection, typeof(byte[]))); foreach (Layer layer in layers) { Add(layer); } }
public void Deserialize(System.IO.Stream stream) { if (stream == null) { throw new System.ArgumentNullException("stream"); } if (!stream.CanRead) { throw new System.ArgumentException(StringResources.GetString("ExStrSrcStreamShouldSupportReading"), "stream"); } System.IO.BinaryReader br = new System.IO.BinaryReader(stream); object[] layers = BinarySerializer.DeserializeObjectArray(br); Clear(); foreach (Layer layer in layers) { Add(layer); } }