How can I get v2 of protobuf-net to ignore the fact that my class implements ICollection, IEnumerable, etc?
For this particular scenario, I only want the fields I have flagged as [ProtoMember] to be serialized.
I am currently in the process of converting from using protobuf-net v1 to using v2. I have a particular structure which is now serializing incorrectly because of the change. It looks something like the following:
[ProtoContract]
public class FileTree : ICollection<FilePath>, IEnumerable<FilePath>, IEnumerable, INotifyCollectionChanged, INotifyPropertyChanged {
private FileTreeNode _Root;
[ProtoMember (1)]
public FileTreeNode Root {
get { return _Root; }
set { _Root = value; }
}
}
The FileTree class was written to collapse file paths like "C:\happy.txt" "C:\history.txt" into something more like
"C:\h"
└─── "appy.txt"
└─── "istory.txt"
The structure eliminates redundancy in the path strings. So, I really don't want the FileTree class being serialized via the IEnumerable functions because then it just gets stored as "C:\happy.txt", "C:\history.txt", etc. Right now, in the serialization of a FileTree object, each path is getting print out in full.
EDIT: One last thing I should mention -- I have an On_Deserialization function in FileTree which is tagged with [ProtoAfterDeserialization]. I put a breakpoint in the function, but it is not getting hit. Is this related to the way this class is being serialized?