示例
[Visual Basic, C#] 下面的示例连接到消息队列并将消息发送到该队列。[Visual Basic]
Imports System
Imports System.MessagingNamespace MyProject
'/ <summary>
'/ Provides a container class for the example.
'/ </summary>
Public Class MyNewQueue
'**************************************************
' Provides an entry point into the application.
'
' This example sends a message to a queue.
'************************************************** Public Shared Sub Main() ' Create a new instance of the class.
Dim myNewQueue As New MyNewQueue() ' Send a message to a queue.
myNewQueue.SendMessage() Return End Sub 'Main
'**************************************************
' Sends a message to a queue.
'************************************************** Public Sub SendMessage() ' Connect to a queue on the local computer.
Dim myQueue As New MessageQueue(".\myQueue") ' Send a message to the queue.
If myQueue.Transactional = True Then
myQueue.Send("My Message Data.", New _
MessageQueueTransaction())
Else
myQueue.Send("My Message Data.")
End If Return End Sub 'SendMessage End Class 'MyNewQueue
End Namespace 'MyProject
[C#]
using System;
using System.Messaging;namespace MyProject
{ /// <summary>
/// Provides a container class for the example.
/// </summary>
public class MyNewQueue
{ //**************************************************
// Provides an entry point into the application.
//
// This example sends a message to a queue.
//************************************************** public static void Main()
{
// Create a new instance of the class.
MyNewQueue myNewQueue = new MyNewQueue(); // Send a message to a queue.
myNewQueue.SendMessage(); return;
}
//**************************************************
// Sends a message to a queue.
//**************************************************
public void SendMessage()
{
// Connect to a queue on the local computer.
MessageQueue myQueue = new MessageQueue(".\\myQueue"); // Send a message to the queue.
if (myQueue.Transactional == true)
{
myQueue.Send("My Message Data.", new
MessageQueueTransaction());
}
else
{
myQueue.Send("My Message Data.");
} return;
}
}
}
不知道对你有没有帮助!
[Visual Basic, C#] 下面的示例连接到消息队列并将消息发送到该队列。[Visual Basic]
Imports System
Imports System.MessagingNamespace MyProject
'/ <summary>
'/ Provides a container class for the example.
'/ </summary>
Public Class MyNewQueue
'**************************************************
' Provides an entry point into the application.
'
' This example sends a message to a queue.
'************************************************** Public Shared Sub Main() ' Create a new instance of the class.
Dim myNewQueue As New MyNewQueue() ' Send a message to a queue.
myNewQueue.SendMessage() Return End Sub 'Main
'**************************************************
' Sends a message to a queue.
'************************************************** Public Sub SendMessage() ' Connect to a queue on the local computer.
Dim myQueue As New MessageQueue(".\myQueue") ' Send a message to the queue.
If myQueue.Transactional = True Then
myQueue.Send("My Message Data.", New _
MessageQueueTransaction())
Else
myQueue.Send("My Message Data.")
End If Return End Sub 'SendMessage End Class 'MyNewQueue
End Namespace 'MyProject
[C#]
using System;
using System.Messaging;namespace MyProject
{ /// <summary>
/// Provides a container class for the example.
/// </summary>
public class MyNewQueue
{ //**************************************************
// Provides an entry point into the application.
//
// This example sends a message to a queue.
//************************************************** public static void Main()
{
// Create a new instance of the class.
MyNewQueue myNewQueue = new MyNewQueue(); // Send a message to a queue.
myNewQueue.SendMessage(); return;
}
//**************************************************
// Sends a message to a queue.
//**************************************************
public void SendMessage()
{
// Connect to a queue on the local computer.
MessageQueue myQueue = new MessageQueue(".\\myQueue"); // Send a message to the queue.
if (myQueue.Transactional == true)
{
myQueue.Send("My Message Data.", new
MessageQueueTransaction());
}
else
{
myQueue.Send("My Message Data.");
} return;
}
}
}
不知道对你有没有帮助!
解决方案 »
- 是不是javascript的执行效率远远大于C#?
- 关于线程
- 利用XPath作为搜索条件,构建你的对象容器
- 求解。。。将数字写入文件时变成对应的ASCII码了!请问怎么解决》?
- 【C# winform水晶报表问题】请教各位一下,如何使动态连接的数据表内容显示在水晶报表里
- 请问怎么判断combobox.txt的值是属于listbox中的值中的一个如果不是就删除怎么做?
- vs.net最新版是什么?
- 下拉列表框的绑定问题,知道的进来帮助我下。
- 请问大侠:怎么用c#写一个com+组件,怎么用c#调用一个com+组件?
- listbox的遍历问题,急急急!!!
- 微软的.net框架类库FCL在哪里可以查到有关它的说明,MSDN吗?有没有象JDK API一样的东东?
- .net里面的线程问题,欢迎大家讨论!
吗?