Send events to Azure Event Hubs using. NET Standard. Note. This sample is available on Git. Hub. This tutorial shows how to write a. NET Core console application that sends a set of messages to an event hub. You can run the Git. Hub solution as is, replacing the Eh. Connection. String and Eh. C Program Exit Event RaleighThe following implicitly generate full fences Cs lock statement Monitor. EnterMonitor. Exit All methods on the Interlocked class well cover these soon. Abstract as base bool break byte case catch char checked class const continue decimal default delegate do double else enum event explicit extern false finally fixed. Entity. Path strings with your event hub values. Or you can follow the steps in this tutorial to create your own. Prerequisites. To send messages to an event hub, we will use Visual Studio to write a C console application. Create an Event Hubs namespace and an event hub. The first step is to use the Azure portal to create a namespace for the event hub type, and obtain the management credentials that your application needs to communicate with the event hub. Page 1 Microsoft C Projects for the Classroom Written by Alfred C Thompson II Distributed by Mainfunction. I have a published application in C. The problem here is whenever I close the main form by clicking on the red exit button, it closes the form but it doesnt close. C Tutorial for beginners Learn C Sharp Programming in simple and easy steps starting from Environment setup, Basic Syntax, Data Types, Type Conversion. To create a namespace and an event hub, follow the procedure in this article, and then proceed with the following steps. Create a console application. Start Visual Studio. From the File menu, click New, and then click Project. Create a. NET Core console application. Add the Event Hubs Nu. Get package. Add the Microsoft. Azure. Event. Hubs. NET Standard library Nu. Get package to your project by following these steps Right click the newly created project and select Manage Nu. Get Packages. Click the Browse tab, then search for Microsoft. Azure. Event. Hubs and select the Microsoft. Azure. Event. Hubs package. Click Install to complete the installation, then close this dialog box. Write some code to send messages to the event hub. Add the following using statements to the top of the Program. Microsoft. Azure. Event. Hubs. using System. Text. using System. Threading. Tasks. Add constants to the Program class for the Event Hubs connection string and entity path individual event hub name. Replace the placeholders in brackets with the proper values that were obtained when creating the event hub. Make sure that the Event Hubs connection string is the namespace level connection string, and not the event hub string. Event. Hub. Client event. Hub. Client. private const string Eh. Connection. String Event Hubs connection string. Eh. Entity. Path Event Hub pathname. Add a new method named Main. Async to the Program class, as follows private static async Task Main. Asyncstring args. Creates an Event. Hubs. Connection. String. Builder object from the connection string, and sets the Entity. Path. Typically, the connection string should have the entity path in it, but for the sake of this simple scenario. String. Builder new Event. Hubs. Connection. String. BuilderEh. Connection. String. Entity. Path Eh. Entity. Path. event. Hub. Client Event. Hub. Client. Create. From. Connection. Stringconnection. String. Builder. To. String. await Send. Messages. To. Event. Hub1. 00. await event. Hub. Client. Close. Async. Console. Write. LinePress ENTER to exit. Console. Read. Line. Add a new method named Send. Messages. To. Event. Hub to the Program class, as follows Creates an event hub client and sends 1. Task Send. Messages. To. Event. Hubint num. Messages. To. Send. Messages. To. Send i. Message i. Console. Write. LineSending message message. Hub. Client. Send. Asyncnew Event. DataEncoding. UTF8. Get. Bytesmessage. Exception exception. Console. Write. LineDate. Time. Now Exception exception. Message. await Task. Delay1. 0. Console. Write. Linenum. Messages. To. Send messages sent. Add the following code to the Main method in the Program class. Main. Asyncargs. Get. Awaiter. Get. Result. Here is what your Program. Sample. Sender. using System. System. Text. using System. Threading. Tasks. Microsoft. Azure. Event. Hubs. public class Program. Event. Hub. Client event. Hub. Client. private const string Eh. Connection. String Event Hubs connection string. Eh. Entity. Path Event Hub pathname. Echo F1 Speedometer Manual Transmission more. Mainstring args. Main. Asyncargs. Get. Awaiter. Get. Result. private static async Task Main. Asyncstring args. Creates an Event. Hubs. Connection. String. Builder object from the connection string, and sets the Entity. Path. Typically, the connection string should have the entity path in it, but for the sake of this simple scenario. String. Builder new Event. Hubs. Connection. String. BuilderEh. Connection. String. Entity. Path Eh. Entity. Path. event. Hub. Client Event. Hub. Client. Create. From. Connection. Stringconnection. String. Builder. To. String. await Send. Messages. To. Event. Hub1. 00. await event. Hub. Client. Close. Async. Console. Write. LinePress ENTER to exit. Console. Read. Line. Creates an event hub client and sends 1. Task Send. Messages. To. Event. Hubint num. Messages. To. Send. Messages. To. Send i. Message i. Console. Write. LineSending message message. Hub. Client. Send. Asyncnew Event. DataEncoding. UTF8. Get. Bytesmessage. Exception exception. Console. Write. LineDate. Time. Now Exception exception. Message. await Task. Delay1. 0. Console. Write. Linenum. Messages. To. Send messages sent. Run the program, and ensure that there are no errors. Congratulations You have now sent messages to an event hub. Next steps. You can learn more about Event Hubs by visiting the following links.