次の方法で共有


DesignerVerbCollection クラス

DesignerVerb オブジェクトのコレクションを表します。

この型のすべてのメンバの一覧については、DesignerVerbCollection メンバ を参照してください。

System.Object
   System.Collections.CollectionBase
      System.ComponentModel.Design.DesignerVerbCollection

<ComVisible(True)>
Public Class DesignerVerbCollection   Inherits CollectionBase
[C#]
[ComVisible(true)]
public class DesignerVerbCollection : CollectionBase
[C++]
[ComVisible(true)]
public __gc class DesignerVerbCollection : public CollectionBase
[JScript]
public
   ComVisible(true)
class DesignerVerbCollection extends CollectionBase

スレッドセーフ

この型の public static (Visual Basicでは Shared) のすべてのメンバは、マルチスレッド操作で安全に使用できます。インスタンスのメンバの場合は、スレッドセーフであるとは限りません。

解説

このクラスは、 DesignerVerb オブジェクトを格納できるコレクションを提供します。

使用例

 
' Creates an empty DesignerVerbCollection.
Dim collection As New DesignerVerbCollection()

' Adds a DesignerVerb to the collection.
collection.Add(New DesignerVerb("Example designer verb", New EventHandler(AddressOf Me.ExampleEvent)))

' Adds an array of DesignerVerb objects to the collection.
Dim verbs As DesignerVerb() = {New DesignerVerb("Example designer verb", New EventHandler(AddressOf Me.ExampleEvent)), New DesignerVerb("Example designer verb", New EventHandler(AddressOf Me.ExampleEvent))}
collection.AddRange(verbs)

' Adds a collection of DesignerVerb objects to the collection.
Dim verbsCollection As New DesignerVerbCollection()
verbsCollection.Add(New DesignerVerb("Example designer verb", New EventHandler(AddressOf Me.ExampleEvent)))
verbsCollection.Add(New DesignerVerb("Example designer verb", New EventHandler(AddressOf Me.ExampleEvent)))
collection.AddRange(verbsCollection)

' Tests for the presence of a DesignerVerb in the collection, 
' and retrieves its index if it is found.
Dim testVerb As New DesignerVerb("Example designer verb", New EventHandler(AddressOf Me.ExampleEvent))
Dim itemIndex As Integer = -1
If collection.Contains(testVerb) Then
    itemIndex = collection.IndexOf(testVerb)
End If

' Copies the contents of the collection, beginning at index 0, 
' to the specified DesignerVerb array.
' 'verbs' is a DesignerVerb array.
collection.CopyTo(verbs, 0)

' Retrieves the count of the items in the collection.
Dim collectionCount As Integer = collection.Count

' Inserts a DesignerVerb at index 0 of the collection.
collection.Insert(0, New DesignerVerb("Example designer verb", New EventHandler(AddressOf Me.ExampleEvent)))

' Removes the specified DesignerVerb from the collection.
Dim verb As New DesignerVerb("Example designer verb", New EventHandler(AddressOf Me.ExampleEvent))
collection.Remove(verb)

' Removes the DesignerVerb at index 0.
collection.RemoveAt(0)

[C#] 
// Creates an empty DesignerVerbCollection.
DesignerVerbCollection collection = new DesignerVerbCollection();

// Adds a DesignerVerb to the collection.
collection.Add( new DesignerVerb("Example designer verb", new EventHandler(this.ExampleEvent)) );

// Adds an array of DesignerVerb objects to the collection.
DesignerVerb[] verbs = { new DesignerVerb("Example designer verb", new EventHandler(this.ExampleEvent)), new DesignerVerb("Example designer verb", new EventHandler(this.ExampleEvent)) };
collection.AddRange( verbs );

// Adds a collection of DesignerVerb objects to the collection.
DesignerVerbCollection verbsCollection = new DesignerVerbCollection();
verbsCollection.Add( new DesignerVerb("Example designer verb", new EventHandler(this.ExampleEvent)) );
verbsCollection.Add( new DesignerVerb("Example designer verb", new EventHandler(this.ExampleEvent)) );
collection.AddRange( verbsCollection );

// Tests for the presence of a DesignerVerb in the collection, 
// and retrieves its index if it is found.
DesignerVerb testVerb = new DesignerVerb("Example designer verb", new EventHandler(this.ExampleEvent));
int itemIndex = -1;
if( collection.Contains( testVerb ) )
    itemIndex = collection.IndexOf( testVerb );

// Copies the contents of the collection, beginning at index 0, 
// to the specified DesignerVerb array.
// 'verbs' is a DesignerVerb array.
collection.CopyTo( verbs, 0 );

// Retrieves the count of the items in the collection.
int collectionCount = collection.Count;

// Inserts a DesignerVerb at index 0 of the collection.
collection.Insert( 0, new DesignerVerb("Example designer verb", new EventHandler(this.ExampleEvent)) );

// Removes the specified DesignerVerb from the collection.
DesignerVerb verb = new DesignerVerb("Example designer verb", new EventHandler(this.ExampleEvent));
collection.Remove( verb );

// Removes the DesignerVerb at index 0.
collection.RemoveAt(0);

[C++] 
// Creates an empty DesignerVerbCollection.
DesignerVerbCollection* collection = new DesignerVerbCollection();

// Adds a DesignerVerb to the collection.
collection->Add( new DesignerVerb(S"Example designer verb", new EventHandler(this, &Class1::ExampleEvent)) );

// Adds an array of DesignerVerb objects to the collection.
DesignerVerb* verbs[] = {
    new DesignerVerb(S"Example designer verb", new EventHandler(this, &Class1::ExampleEvent)),
    new DesignerVerb(S"Example designer verb", new EventHandler(this, &Class1::ExampleEvent))
};
collection->AddRange( verbs );

// Adds a collection of DesignerVerb objects to the collection.
DesignerVerbCollection* verbsCollection = new DesignerVerbCollection();
verbsCollection->Add( new DesignerVerb(S"Example designer verb", new EventHandler(this, &Class1::ExampleEvent)) );
verbsCollection->Add( new DesignerVerb(S"Example designer verb", new EventHandler(this, &Class1::ExampleEvent)) );
collection->AddRange( verbsCollection );

// Tests for the presence of a DesignerVerb in the collection,
// and retrieves its index if it is found.
DesignerVerb* testVerb = new DesignerVerb(S"Example designer verb", new EventHandler(this, &Class1::ExampleEvent));
int itemIndex = -1;
if( collection->Contains( testVerb ) )
    itemIndex = collection->IndexOf( testVerb );

// Copies the contents of the collection, beginning at index 0,
// to the specified DesignerVerb array.
// 'verbs' is a DesignerVerb array.
collection->CopyTo( verbs, 0 );

// Retrieves the count of the items in the collection.
int collectionCount = collection->Count;

// Inserts a DesignerVerb at index 0 of the collection.
collection->Insert( 0, new DesignerVerb(S"Example designer verb", new EventHandler(this, &Class1::ExampleEvent)) );

// Removes the specified DesignerVerb from the collection.
DesignerVerb* verb = new DesignerVerb(S"Example designer verb", new EventHandler(this, &Class1::ExampleEvent));
collection->Remove( verb );

// Removes the DesignerVerb at index 0.
collection->RemoveAt(0);

[JScript] JScript のサンプルはありません。Visual Basic、C#、および C++ のサンプルを表示するには、このページの左上隅にある言語のフィルタ ボタン 言語のフィルタ をクリックします。

必要条件

名前空間: System.ComponentModel.Design

プラットフォーム: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 ファミリ

アセンブリ: System (System.dll 内)

参照

DesignerVerbCollection メンバ | System.ComponentModel.Design 名前空間