Reputation: 81
I want to map datetime in c# datetime in protobuf . Do you have any suggestion to do this?
Upvotes: 8
Views: 11183
Reputation: 773
Use this nuget:
Mapster.Protobuf.extension
It adds protobuf mappings to mapster
Upvotes: 0
Reputation: 1063824
If you mean the Google implementation: quite simply, FromDateTime
and ToDateTime
Google.Protobuf.WellKnownTypes.Timestamp protoTimestamp
= Google.Protobuf.WellKnownTypes.Timestamp.FromDateTime(DateTime.Now);
(I add that qualification because protobuf-net also defines similarly named types, which have implicit conversion operators to/from DateTime
)
Upvotes: 11