/// <summary>Snippet for AppendRows</summary> public async Task AppendRows() { // Snippet: AppendRows(CallSettings, BidirectionalStreamingSettings) // Create client BigQueryWriteClient bigQueryWriteClient = BigQueryWriteClient.Create(); // Initialize streaming call, retrieving the stream object BigQueryWriteClient.AppendRowsStream response = bigQueryWriteClient.AppendRows(); // Sending requests and retrieving responses can be arbitrarily interleaved // Exact sequence will depend on client/server behavior // Create task to do something with responses from server Task responseHandlerTask = Task.Run(async() => { // Note that C# 8 code can use await foreach AsyncResponseStream <AppendRowsResponse> responseStream = response.GetResponseStream(); while (await responseStream.MoveNextAsync()) { AppendRowsResponse responseItem = responseStream.Current; // Do something with streamed response } // The response stream has completed }); // Send requests to the server bool done = false; while (!done) { // Initialize a request AppendRowsRequest request = new AppendRowsRequest { WriteStreamAsWriteStreamName = WriteStreamName.FromProjectDatasetTableStream("[PROJECT]", "[DATASET]", "[TABLE]", "[STREAM]"), Offset = 0L, ProtoRows = new AppendRowsRequest.Types.ProtoData(), TraceId = "", }; // Stream a request to the server await response.WriteAsync(request); // Set "done" to true when sending requests is complete } // Complete writing requests to the stream await response.WriteCompleteAsync(); // Await the response handler // This will complete once all server responses have been processed await responseHandlerTask; // End snippet }