DesignerVerbCollection Class
Assembly: System (in system.dll)
This class provides a collection that can contain DesignerVerb objects.
Note: |
|---|
| The HostProtectionAttribute attribute applied to this class has the following Resources property value: SharedState. The HostProtectionAttribute does not affect desktop applications (which are typically started by double-clicking an icon, typing a command, or entering a URL in a browser). For more information, see the HostProtectionAttribute class or SQL Server Programming and Host Protection Attributes. |
The following code example demonstrates how to use the DesignerVerbCollection class. The example creates a new instance of the class and uses several methods to add statements to the collection, return their index, and add or remove attributes at a specific index point.
// 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);
System.Collections.CollectionBase
System.ComponentModel.Design.DesignerVerbCollection
System.Workflow.ComponentModel.Design.ActivityDesignerVerbCollection
Windows 98, Windows Server 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.
Note: