sandialabs/Arcus

Subnet and IPAddressRange should be serializable

rheone opened this issue · 2 comments

Subnet and IPAddressRange should implement ISerializable, be decorated by SerializableAttribute and have custom serialize logic.

Subnet should serialize head address bytes and routing prefix
IPAddressRange should serialize head address bytes and tail address bytes

Can you be a bit more explicit as to what exactly should be spit out once serialized?

Not really without explicitly implementing it. See MacAddress as an example.

It should be pretty straight forward. Decorated with SerializableAttribute and implement ISerializable.

Use the provided a public void ISerializable.GetObjectData([NotNull] SerializationInfo info, StreamingContext context) method to serialize

  • For Subnet include the IPAddress Head and int RoutePrefix
  • For IPAddressRange include IPAddress Head and IPAddress Tail

Then create the protected XXXX([NotNull] SerializationInfo info, StreamingContext context) constructor deserialize data, and have it delegate to the appropriate existing constructor.

Standard custom Custom serialization approach.