-
Notifications
You must be signed in to change notification settings - Fork 25.1k
Open
Labels
⌚ Not TriagedSource - Docs.msDocs Customer feedback via GitHub IssueDocs Customer feedback via GitHub Issueaspnet-core/svcgRPCgrpc/subsvc
Description
Description
In the "Dates and times" section, the example code starts with:
message Meeting {
string subject = 1;
google.protobuf.Timestamp start = 2;
google.protobuf.Duration duration = 3;
}
But the next code uses Time and Duration for the Meeting instance's properties, when it probably should instead use start and duration:
// Create Timestamp and Duration from .NET DateTimeOffset and TimeSpan.
var meeting = new Meeting
{
Time = Timestamp.FromDateTimeOffset(meetingTime), // also FromDateTime()
Duration = Duration.FromTimeSpan(meetingLength)
};
// Convert Timestamp and Duration to .NET DateTimeOffset and TimeSpan.
var time = meeting.Time.ToDateTimeOffset();
var duration = meeting.Duration?.ToTimeSpan();
Correcting this may reduce confusion. Thanks...
Page URL
https://learn.microsoft.com/en-us/aspnet/core/grpc/protobuf?view=aspnetcore-8.0
Content source URL
https://github.com/dotnet/AspNetCore.Docs/blob/main/aspnetcore/grpc/protobuf.md
Document ID
4ce52659-cd0f-0172-2f8c-e58b8497eadc
Article author
Metadata
Metadata
Assignees
Labels
⌚ Not TriagedSource - Docs.msDocs Customer feedback via GitHub IssueDocs Customer feedback via GitHub Issueaspnet-core/svcgRPCgrpc/subsvc