How can I get v2 protobuf-net to ignore the fact that my class implements ICollection, IEnumerable, etc.?
In this particular scenario, I want the fields marked as [ProtoMember] to be serialized.
I am currently moving from using protobuf-net v1 to using v2. I have a specific structure that is now serializing incorrectly due to a change. It looks something like this:
[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 smooth out file paths such as "C: \ happy.txt" "C: \ history.txt", to something more than
"C:\h" └─── "appy.txt" └─── "istory.txt"
The structure eliminates redundancy in the path lines. Thus, I really do not want the FileTree class to be serialized through IEnumerable functions, because then it is simply stored as "C: \ happy.txt", "C: \ history.txt", etc. Right now, in the serialization of the FileTree object, every path is printed completely.
EDIT: The last thing I should mention is that I have the On_Deserialization function in FileTree, which is labeled [ProtoAfterDeserialization]. I set a breakpoint in the function, but it does not fall. Is this related to how this class is serialized?
source share