views:

110

answers:

3

Hey everyone,

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!

A: 

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

Darin Dimitrov
What do you mean not interoperable?
leppie
@leppie, by not interoperable I mean that this format cannot be understood by languages/platforms other than .NET.
Darin Dimitrov
A: 

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

Tony Lambert
A: 

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

Matan