Not sure what your talking about. My write code just recurses over all
types. If its a value type then I write it out to file, else its either a
field or property.
??? value-type vs reference-type relates to types; field vs property
relates to members... it can be a value-type *and* a field or property
member...
(and it should work for arbitrary ones I imagine)
I disagree; "arbitrary" has to include reference-types, which you
aren't considering.
but it probably will just end up making a mess.
I'm thinking you already got there... sorry, but I *really* think
you're deeply over your head here. Custom serialization *of arbitrary
types* is not trivial. I'm not even going to /begin/ to unpick that
code, especially with the unsafe hacks. Serializing your own known
type (from the inside) is fair enough; implement ISerializable and the
custom ctor - job done. But before trying to out-do the serializer, I
would want to *know* that the regular serialization engine isn't good
enough (i.e. have a definition of "good enough"). I'm not convinced
that this is going to be worth the development / support cost... I'd
look at simply zipping what you have, picking either xml or binary
serialization as most appropriate, and trying a few different
compression algorithms (gzip, deflate, bzip2, etc), perhaps from a few
providers (ms, #ziplib, etc). That would take, at worst, 20 minutes.
With zero ongoing cost.
Marc