MessageQueue.Delete(String) Yöntem
Tanım
Önemli
Bazı bilgiler ürünün ön sürümüyle ilgilidir ve sürüm öncesinde önemli değişiklikler yapılmış olabilir. Burada verilen bilgilerle ilgili olarak Microsoft açık veya zımni hiçbir garanti vermez.
Message Queuing sunucusundaki bir kuyruğu siler.
public:
static void Delete(System::String ^ path);
public static void Delete (string path);
static member Delete : string -> unit
Public Shared Sub Delete (path As String)
Parametreler
- path
- String
Silinecek kuyruğun konumu.
Özel durumlar
path
parametresi veya null
boş bir dizedir ("").
Parametrenin path
söz dizimi geçerli değil.
-veya-
Message Queuing yöntemine erişilirken bir hata oluştu.
Örnekler
Aşağıdaki kod örneği, varsa Message Queuing kuyruğunun silinmesini sağlar.
#using <system.dll>
#using <system.messaging.dll>
using namespace System;
using namespace System::Messaging;
int main()
{
// Determine whether the queue exists.
if ( MessageQueue::Exists( ".\\myQueue" ) )
{
try
{
// Delete the queue.
MessageQueue::Delete( ".\\myQueue" );
}
catch ( MessageQueueException^ e )
{
if ( e->MessageQueueErrorCode == MessageQueueErrorCode::AccessDenied )
{
Console::WriteLine( "Access is denied. Queue might be a system queue." );
}
// Handle other sources of MessageQueueException.
}
}
return 0;
}
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 verifies existence and attempts to
// delete a queue.
//**************************************************
public static void Main()
{
// Determine whether the queue exists.
if (MessageQueue.Exists(".\\myQueue"))
{
try
{
// Delete the queue.
MessageQueue.Delete(".\\myQueue");
}
catch(MessageQueueException e)
{
if(e.MessageQueueErrorCode ==
MessageQueueErrorCode.AccessDenied)
{
Console.WriteLine("Access is denied. " +
"Queue might be a system queue.");
}
// Handle other sources of MessageQueueException.
}
}
return;
}
}
}
Imports System.Messaging
Public Class MyNewQueue
' Provides an entry point into the application.
'
' This example verifies existence and attempts to
' delete a queue.
Public Shared Sub Main()
' Determine whether the queue exists.
If MessageQueue.Exists(".\myQueue") Then
Try
' Delete the queue.
MessageQueue.Delete(".\myQueue")
Catch e As MessageQueueException
If e.MessageQueueErrorCode = _
MessageQueueErrorCode.AccessDenied Then
Console.WriteLine("Access is denied. " _
+ "Queue might be a system queue.")
End If
' Handle other sources of exceptions as necessary.
End Try
End If
Return
End Sub
End Class
Açıklamalar
parametresinin path
söz dizimi kuyruğun türüne bağlıdır.
Kuyruk türü | Syntax |
---|---|
Genel kuyruk | MachineName \QueueName |
Özel kuyruk | MachineName \Private$ \QueueName |
Daha fazla söz dizimi için özelliğine Path bakın.
Alternatif olarak, kuyruk yolunu açıklamak için veya Label kullanabilirsinizFormatName.
Başvuru | Syntax |
---|---|
Biçim adı | FormatName:[ biçim adı ] |
Etiketle | Label:[ label ] |
Aşağıdaki tabloda bu yöntemin çeşitli Çalışma Grubu modlarında kullanılabilir olup olmadığı gösterilmektedir.
Çalışma grubu modu | Kullanılabilir |
---|---|
Yerel bilgisayar | Yes |
Yerel bilgisayar ve doğrudan biçim adı | Yes |
Uzak bilgisayar | No |
Uzak bilgisayar ve doğrudan biçim adı | No |