EventData eventData = new EventData(Encoding.UTF8.GetBytes("This is a message.")); eventData.Properties.AddInt("messageCount", 10);
EventData eventData = new EventData(Encoding.UTF8.GetBytes("This is a message.")); eventData.Properties.AddInt("timestamp", (int)DateTimeOffset.UtcNow.ToUnixTimeSeconds());In this example, we again create a new EventData object and add a UTF8-encoded string message to it. We then call the AddInt method on the Properties object of the EventData object and pass in a string key for the integer value ("timestamp") and the current Unix timestamp (converted to an integer) as the value. This adds a unique timestamp to the EventData object as a custom property. The package library for the Microsoft.Azure.EventHubs library is "Microsoft.Azure.EventHubs" and can be found on NuGet.