MessageQueue.Exists メソッドとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > MessageQueue.Exists メソッドの意味・解説 

MessageQueue.Exists メソッド

指定したパスメッセージ キューキュー存在するかどうか判断します

名前空間: System.Messaging
アセンブリ: System.Messaging (system.messaging.dll 内)
構文構文

例外例外
解説解説

Exists メソッドは、指定したパスメッセージ キューキュー存在するかどうか判断します指定した書式名のキュー存在するかどうか判断するメソッドはありません。書式構文およびその他のパス構文書式詳細については、Path プロパティトピック参照してください

Exists は、負荷が高い操作です。アプリケーション必要な場合にだけ使用してください

メモメモ

Exists メソッドは、FormatName プレフィックスサポートしていません。

path パラメータ構文は、キュー種類によって異なります詳細については、次の表を参照してください

キュー種類

構文

パブリック キュー

MachineName\QueueName

リモート プライベート キュー存在確認するために、Exists呼び出すことができませんでした

構文詳細については、Path プロパティトピック参照してください

Label使用してキューパス記述することもできます

このメソッド各種ワークグループ モード使用できるかどうか次の表に示します

使用例使用例

メッセージ キューキュー存在するかどうか確認してから、それを削除するコード例次に示します

Imports System
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 'Main

End Class 'MyNewQueue 

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;
        }

    }
}
#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;
}

package MyProject;

import System.*;
import System.Messaging.*;

/// <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(String[]
 args)
    {
        // Determine whether the queue exists.
        if (MessageQueue.Exists(".\\myQueue")) {
            try {
                // Delete the queue.
                MessageQueue.Delete(".\\myQueue");
            }
            catch (MessageQueueException e) {
                if (e.get_MessageQueueErrorCode().
                    Equals(MessageQueueErrorCode.AccessDenied)) {
                    Console.WriteLine("Access is denied. "
                        + "Queue might be a system queue.");
                }
                // Handle other sources of MessageQueueException.
            }
        }        
        return;
    } //main
} //MyNewQueue 
.NET Framework のセキュリティ.NET Frameworkセキュリティ
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照



英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

「MessageQueue.Exists メソッド」の関連用語

MessageQueue.Exists メソッドのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



MessageQueue.Exists メソッドのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2024 Microsoft.All rights reserved.

©2024 GRAS Group, Inc.RSS