MessageQueuePermissionEntryCollection.AddRange メソッド
定義
重要
一部の情報は、リリース前に大きく変更される可能性があるプレリリースされた製品に関するものです。 Microsoft は、ここに記載されている情報について、明示または黙示を問わず、一切保証しません。
指定した一連のアクセス許可エントリをコレクションに追加します。
オーバーロード
AddRange(MessageQueuePermissionEntry[]) |
指定した一連のアクセス許可エントリをコレクションに追加します。 |
AddRange(MessageQueuePermissionEntryCollection) |
指定した一連のアクセス許可エントリをコレクションに追加します。 |
AddRange(MessageQueuePermissionEntry[])
指定した一連のアクセス許可エントリをコレクションに追加します。
public:
void AddRange(cli::array <System::Messaging::MessageQueuePermissionEntry ^> ^ value);
public void AddRange (System.Messaging.MessageQueuePermissionEntry[] value);
member this.AddRange : System.Messaging.MessageQueuePermissionEntry[] -> unit
Public Sub AddRange (value As MessageQueuePermissionEntry())
パラメーター
- value
- MessageQueuePermissionEntry[]
追加するアクセス許可エントリを格納している MessageQueuePermissionEntry 型オブジェクトの配列。
例
次のコード例は、AddRange(MessageQueuePermissionEntry[]) の使用方法を示します。
// Connect to a queue on the local computer.
MessageQueue^ queue = gcnew MessageQueue(".\\exampleQueue");
// Create a new instance of MessageQueuePermission.
MessageQueuePermission^ permission = gcnew MessageQueuePermission();
// Get an instance of MessageQueuePermissionEntryCollection from the
// permission's PermissionEntries property.
MessageQueuePermissionEntryCollection^ collection =
permission->PermissionEntries;
// Create an array of type MessageQueuePermissionEntry.
array<MessageQueuePermissionEntry^>^ entries =
gcnew array<MessageQueuePermissionEntry^>(1);
// Create a new instance of MessageQueuePermissionEntry and place the
// instance in the array.
entries[0] = gcnew MessageQueuePermissionEntry(
MessageQueuePermissionAccess::Receive,
queue->MachineName,
queue->Label,
queue->Category.ToString());
// Add the array to the collection.
collection->AddRange(entries);
queue->Close();
// Connect to a queue on the local computer.
MessageQueue queue = new MessageQueue(".\\exampleQueue");
// Create a new instance of MessageQueuePermission.
MessageQueuePermission permission = new MessageQueuePermission();
// Get an instance of MessageQueuePermissionEntryCollection from the
// permission's PermissionEntries property.
MessageQueuePermissionEntryCollection collection =
permission.PermissionEntries;
// Create an array of type MessageQueuePermissionEntry.
MessageQueuePermissionEntry[] entries =
new MessageQueuePermissionEntry[1];
// Create a new instance of MessageQueuePermissionEntry and place the
// instance in the array.
entries[0] = new MessageQueuePermissionEntry(
MessageQueuePermissionAccess.Receive,
queue.MachineName,
queue.Label,
queue.Category.ToString());
// Add the array to the collection.
collection.AddRange(entries);
適用対象
AddRange(MessageQueuePermissionEntryCollection)
指定した一連のアクセス許可エントリをコレクションに追加します。
public:
void AddRange(System::Messaging::MessageQueuePermissionEntryCollection ^ value);
public void AddRange (System.Messaging.MessageQueuePermissionEntryCollection value);
member this.AddRange : System.Messaging.MessageQueuePermissionEntryCollection -> unit
Public Sub AddRange (value As MessageQueuePermissionEntryCollection)
パラメーター
追加するアクセス許可エントリを格納している MessageQueuePermissionEntryCollection。
例
次のコード例は、AddRange(MessageQueuePermissionEntryCollection) の使用方法を示します。
// Connect to a queue on the local computer.
MessageQueue^ queue = gcnew MessageQueue(".\\exampleQueue");
// Create a new instance of MessageQueuePermission.
MessageQueuePermission^ permission = gcnew MessageQueuePermission();
// Create a new instance of MessageQueuePermissionEntry.
MessageQueuePermissionEntry^ entry = gcnew MessageQueuePermissionEntry(
MessageQueuePermissionAccess::Receive,
queue->MachineName,
queue->Label, queue->Category.ToString());
// Add the entry to the permission's collection.
permission->PermissionEntries->Add(entry);
// Create another new instance of MessageQueuePermission.
MessageQueuePermission^ newPermission = gcnew MessageQueuePermission();
// Use AddRange() to append the original permission's collection to the
// new permission's collection.
newPermission->PermissionEntries->AddRange(
permission->PermissionEntries);
// To show that AddRange() copies collections by value and not by
// reference, we'll clear the original permission's collection, then
// display a count of how many entries are in the original permission's
// collection and how many entries are in the new permission's
// collection.
// Clear the original permission's collection.
permission->PermissionEntries->Clear();
// The original permission now contains 0 entries, but the new
// permission still contains 1 entry.
Console::WriteLine("Original permission contains {0} entries.",
permission->PermissionEntries->Count);
Console::WriteLine("New permission contains {0} entries.",
newPermission->PermissionEntries->Count);
queue->Close();
// Connect to a queue on the local computer.
MessageQueue queue = new MessageQueue(".\\exampleQueue");
// Create a new instance of MessageQueuePermission.
MessageQueuePermission permission = new MessageQueuePermission();
// Create a new instance of MessageQueuePermissionEntry.
MessageQueuePermissionEntry entry = new MessageQueuePermissionEntry(
MessageQueuePermissionAccess.Receive,
queue.MachineName,
queue.Label,
queue.Category.ToString());
// Add the entry to the permission's collection.
permission.PermissionEntries.Add(entry);
// Create another new instance of MessageQueuePermission.
MessageQueuePermission newPermission = new MessageQueuePermission();
// Use AddRange() to append the original permission's collection to the
// new permission's collection.
newPermission.PermissionEntries.AddRange(permission.PermissionEntries);
// To show that AddRange() copies collections by value and not by
// reference, we'll clear the original permission's collection, then
// display a count of how many entries are in the original permission's
// collection and how many entries are in the new permission's
// collection.
// Clear the original permission's collection.
permission.PermissionEntries.Clear();
// The original permission now contains 0 entries, but the new
// permission still contains 1 entry.
Console.WriteLine("Original permission contains {0} entries.",
permission.PermissionEntries.Count);
Console.WriteLine("New permission contains {0} entries.",
newPermission.PermissionEntries.Count);
適用対象
GitHub で Microsoft と共同作業する
このコンテンツのソースは GitHub にあります。そこで、issue や pull request を作成および確認することもできます。 詳細については、共同作成者ガイドを参照してください。
.NET