Hmm... I posted a reply to this yesterday, but apparently it didn't make it
through. Let's see if this one gets through to the group.

I've raised an issue for it on Github, but don't have any plans to support
it imminently.

I would strongly urge you away from your current platform-specific DateTime
representation. If you can, use the Timestamp well-known type, which has a
custom Json representation. If not, consider another platform-neutral
representation which is likely to be more readable in a string form anyway.
(DateTime is somewhat broken as a type anyway. When Noda Time 2.0 is out, I
intend to create another Nuget package to bridge that and Protobuf. The
choice of nanosecond precision in Noda Time 2.0 was influenced by proto3.)

Jon
On 4 Nov 2015 7:51 p.m., "Teddy Zhang" <lostind...@gmail.com> wrote:

> +Jon who seems to be the developer on this.
>
> On Monday, November 2, 2015 at 6:18:27 PM UTC-8, Teddy Zhang wrote:
>>
>> I need to override the ToString behavior in C# to make it human readable.
>>
>> E.g. I defined a message type to represent DateTime in C#, and then write
>> a partial class to make it be able to convert from/to DateTime.
>>
>>> message ProtoDateTime
>>>
>>> {
>>>
>>>      sfixed64 BinaryData = 1;
>>>
>>> }
>>>
>>
>> However, the default ToString() doesn't generate human readable contents.
>>
>> Currently the default implantation is (codegen code):
>>
>> public override string ToString() {
>>
>> return pb::JsonFormatter.Default.Format(this);
>>
>> }
>> Which will generate something like this, which is not readable.
>> { "dateTime": { "binaryData": "5247507155853679530" } }
>>
>> Is there a way to override this behavior?
>> If not, is there a plan to support this? Thanks.
>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to protobuf+unsubscr...@googlegroups.com.
To post to this group, send email to protobuf@googlegroups.com.
Visit this group at http://groups.google.com/group/protobuf.
For more options, visit https://groups.google.com/d/optout.

Reply via email to