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);
}
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
The C# codegen only works for proto3 anyway.
Out of your examples, I'd use Duration and Timestamp - and probably just a string for Guid. That's the one I'd be most convinced by though, as the difference in storage between the text and binary representation is so high. Note that this would only be for diagnostic purposes though - the Json formatter and parser will not use it.
(I don't know whether any other platforms support this, mind you...)
Jon