I was about to use the below C# code.
await using (var producerClient = new EventHubProducerClient(ConnectionString, EventHubName))
{
using EventDataBatch eventBatch = await producerClient.CreateBatchAsync();
eventBatch.TryAdd(new EventData(Encoding.UTF8.GetBytes(eventData)));
await producerClient.SendAsync(eventBatch);
}
But in build server this is getting failed as the above is C# 8.0 code and build server supports till C# 7.0 code only. Can someone please help me convert the above code from C# 8.0 to C# 7.0 as I couldn't make it work?