Re: Nullable ignores IsRequired

2009-03-12 Thread Marc Gravell
I should add; re Nullable - if the intent is to support a value with a non-null default, and to know whether it has a *specified* value (rather than the default value), there is a pattern for this (compatible also with XmlSerializer etc); if you use protogen, it will emit the correct C#. I can dig

Re: Nullable ignores IsRequired

2009-03-12 Thread Marc Gravell
Hi Brian. There is a pretty fundamental reason for this: the binary wire format doesn't have a meaningful way of expressing null. Under the default Nullable usage, it treats the null value as "do not serialize" (although there are other ways of expressing this too). I will get this written up on a

Re: Nullable ignores IsRequired

2009-03-12 Thread Bryan
I should have specified that this is in protobuf-net .Net implementation. Also, from looking more at the code, it appears that any reference types ignore the IsRequired parameter. Therefore any class or array that is null will not be serialized and any array or list that is empty will not be ser

Re: Nullable ignores IsRequired

2009-03-12 Thread Kenton Varda
I'm guessing this question is about protobuf-net, specifically? (Not sure since I haven't used it myself.) On Thu, Mar 12, 2009 at 5:23 AM, Bryan wrote: > > I noticed in my test app, and then in the ProtoBuf source, that the > serialization of Nullable properties ignores the IsRequired > parame