zhaw-dnet2/Tasks/Lab11/RankingService/RankingClient/Program.cs

13 lines
468 B
C#

using Grpc.Net.Client;
using RankingService;
using static RankingService.Ranking;
GrpcChannel channel = GrpcChannel.ForAddress("http://localhost:8000");
RankingClient client = new RankingClient(channel);
var result = await client.GetRankingAsync(new RankingService.RankingRequest());
for (int i = 0; i < result.Competitors.Count; i++)
{
Competitor competitor = result.Competitors[i];
Console.WriteLine($"{i + 1}. {competitor.Name}, {competitor.Time}");
}