private static async Task GetAllProducts(ProductProtoServiceClient client) { Console.WriteLine("GetAllProducts started..."); using var clientData = client.GetAllProducts(new GetAllProductsRequest()); await foreach (var responseData in clientData.ResponseStream.ReadAllAsync()) { Console.WriteLine(responseData); } Thread.Sleep(1000); }
private static async Task GetAllProducts(ProductProtoServiceClient client) { //// GetAllProducts //Console.WriteLine("GetAllProducts started..."); //using (var clientData = client.GetAllProducts(new GetAllProductsRequest())) //{ // while (await clientData.ResponseStream.MoveNext(new System.Threading.CancellationToken())) // { // var currentProduct = clientData.ResponseStream.Current; // Console.WriteLine(currentProduct); // } //} //Thread.Sleep(1000); // GetAllProducts with C# 8 Console.WriteLine("GetAllProducts with C#8 started..."); using var clientData = client.GetAllProducts(new GetAllProductsRequest()); await foreach (var responseData in clientData.ResponseStream.ReadAllAsync()) { Console.WriteLine(responseData); } Thread.Sleep(1000); }