문제

I am looking for a serializer that will match my requirements, the serializer can be in the .Net framework, an Open-Sorce or a pay-for product (as long as it can b used directly from the code).

now, my requirements are these:

mandatory

  • Able to handle a cyclic reference.
  • Automatic, usues either attribute or inheritance in the target class, and then simply writes to the file.
  • Positive filtering, meaning that in the target class the fields are marked as what to serialize, and not what not to serialize (like [DataMember] in DataContractSerializer and not like [XmlIgnore] in XmlSerializer).
  • Must use a default constructor.
  • Supports polymorphism (no things like 'KnownTypes' in DataContractSerializer).

preferable

  • Generates file as light-wight as possible.
  • Serialize as fast as possible.
  • Works on non-public fields.

I checked most of the .Net serializers and tryied to find more online, and came out short, all of wiche either not supports cyclic reference, polymorphism, or dose not use any constructor. so right now i'm prettey out of ideas, and i will be glad for some halp.

Thank you!

올바른 솔루션이 없습니다

다른 팁

The closest in the BCL is BinaryFormatter but it is not interoperable.

I would look at Google's Protocol Buffers They are available for a wide range of languages C++, Java, Python and .NET C#.

The problem withe BinaryFormatter is that it is negative filtering (marking the fildes not to serialze) and that it does not use a constractor. about google Protocol Buffers (or ProtoBuff) i had a chance to work with it and its very complicated and can hardly be refered as automatic

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top