public static void Main() { // Create a new instance of the class. QueueExample example = new QueueExample(); try { // Create a nontransactional queue on the local computer. // Note that the queue might not be immediately accessible, and // therefore this example might throw an exception of type // System.Messaging.MessageQueueException when trying to send a // message to the newly created queue. CreateQueue(".\\exampleQueue", false); // Create a nontransactional queue on the local computer. This // queue will be used to receive acknowledgement messages. CreateQueue(".\\exampleAdminQueue", false); // Create a transactional queue on the local computer. CreateQueue(".\\exampleTransQueue", true); // Send a message to a queue. example.Send_ObjectString(); // Send a message to a transactional queue. example.Send_ObjectTransactiontype(); // Send a message to a transactional queue. example.Send_ObjectStringTransactiontype(); // Send a message to a transactional queue. example.Send_ObjectStringTransaction(); // Demonstrate PeekById. example.PeekById_String(); // Demonstrate PeekById. example.PeekById_StringTimespan(); // Demonstrate PeekByCorrelationId. example.PeekByCorrelationId_StringTimespan(); // Receive a message from a transactional queue. example.Receive_TimespanTransactiontype(); // Receive a message from a transactional queue. example.Receive_Transactiontype(); // Demonstrate ReceiveByCorrelationId. example.ReceiveByCorrelationId_StringTimespan(); // Demonstrate ReceiveByCorrelationId. example.ReceiveByCorrelationId_StringTransactiontype(); // Demonstrate ReceiveByCorrelationId. example.ReceiveByCorrelationId_StringTimespanTransactiontype(); // Demonstrate ReceiveByCorrelationId. example.ReceiveByCorrelationId_StringTimespanTransaction(); // Demonstrate ReceiveByCorrelationId. example.ReceiveByCorrelationId_StringTransaction(); // Demonstrate ReceiveById. example.ReceiveById_StringTransactionType(); // Demonstrate ReceiveById. example.ReceiveById_String(); // Demonstrate ReceiveById. example.ReceiveById_StringTransaction(); // Demonstrate ReceiveById. example.ReceiveById_StringTimespanTransaction(); // Demonstrate ReceiveById. example.ReceiveById_StringTimespanTransactiontype(); // Demonstrate ReceiveById. example.ReceiveById_StringTimespan(); // Demonstrate GetAllMessages. example.GetAllMessages(); // Demonstrate GetEnumerator. example.GetEnumerator(); // Demonstrate SetPermissions. example.SetPermissions_StringAccessrights(); // Demonstrate SetPermissions. example.SetPermissions_Accesscontrolentry(); // Demonstrate SetPermissions. example.SetPermissions_StringAccessrightsAccesscontrolentrytype(); // Demonstrate SetPermissions. example.SetPermissions_Accesscontrollist(); // Demonstrate ResetPermissions. example.ResetPermissions(); // Demonstrate Refresh. example.Refresh(); // Demonstrate Purge. example.Purge(); } catch (System.Exception e) { // Write the exception information to the console. Console.WriteLine(e); } }