DesignerVerbCollection 类
定义
表示 DesignerVerb 对象集合。Represents a collection of DesignerVerb objects.
public ref class DesignerVerbCollection : System::Collections::CollectionBase
public class DesignerVerbCollection : System.Collections.CollectionBase
[System.Runtime.InteropServices.ComVisible(true)]
public class DesignerVerbCollection : System.Collections.CollectionBase
type DesignerVerbCollection = class
inherit CollectionBase
[<System.Runtime.InteropServices.ComVisible(true)>]
type DesignerVerbCollection = class
inherit CollectionBase
Public Class DesignerVerbCollection
Inherits CollectionBase
- 继承
- 派生
- 属性
示例
下面的代码示例演示如何使用 DesignerVerbCollection 类。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 = gcnew DesignerVerbCollection;
// Adds a DesignerVerb to the collection.
collection->Add( gcnew DesignerVerb( "Example designer verb",gcnew EventHandler( this, &Class1::ExampleEvent ) ) );
// Adds an array of DesignerVerb objects to the collection.
array<DesignerVerb^>^ verbs = {
gcnew DesignerVerb( "Example designer verb", gcnew EventHandler( this, &Class1::ExampleEvent ) ),
gcnew DesignerVerb( "Example designer verb", gcnew EventHandler( this, &Class1::ExampleEvent ) )};
collection->AddRange( verbs );
// Adds a collection of DesignerVerb objects to the collection.
DesignerVerbCollection^ verbsCollection = gcnew DesignerVerbCollection;
verbsCollection->Add( gcnew DesignerVerb( "Example designer verb", gcnew EventHandler( this, &Class1::ExampleEvent ) ) );
verbsCollection->Add( gcnew DesignerVerb( "Example designer verb", gcnew 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 = gcnew DesignerVerb( "Example designer verb", gcnew 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, gcnew DesignerVerb( "Example designer verb", gcnew EventHandler( this, &Class1::ExampleEvent ) ) );
// Removes the specified DesignerVerb from the collection.
DesignerVerb^ verb = gcnew DesignerVerb( "Example designer verb", gcnew EventHandler( this, &Class1::ExampleEvent ) );
collection->Remove( verb );
// Removes the DesignerVerb at index 0.
collection->RemoveAt( 0 );
// 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);
' 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)
注解
此类提供一个可包含对象的集合 DesignerVerb 。This class provides a collection that can contain DesignerVerb objects.
构造函数
DesignerVerbCollection() |
初始化 DesignerVerbCollection 类的新实例。Initializes a new instance of the DesignerVerbCollection class. |
DesignerVerbCollection(DesignerVerb[]) |
使用指定的 DesignerVerbCollection 对象的数组,初始化 DesignerVerb 类的新实例。Initializes a new instance of the DesignerVerbCollection class using the specified array of DesignerVerb objects. |
属性
Capacity |
获取或设置 CollectionBase 可包含的元素数。Gets or sets the number of elements that the CollectionBase can contain. (继承自 CollectionBase) |
Count |
获取 CollectionBase 实例中包含的元素数。Gets the number of elements contained in the CollectionBase instance. 不能重写此属性。This property cannot be overridden. (继承自 CollectionBase) |
InnerList |
获取一个 ArrayList,它包含 CollectionBase 实例中元素的列表。Gets an ArrayList containing the list of elements in the CollectionBase instance. (继承自 CollectionBase) |
Item[Int32] |
获取或设置指定索引处的 DesignerVerb。Gets or sets the DesignerVerb at the specified index. |
List |
获取一个 IList,它包含 CollectionBase 实例中元素的列表。Gets an IList containing the list of elements in the CollectionBase instance. (继承自 CollectionBase) |
方法
Add(DesignerVerb) |
将指定的 DesignerVerb 添加到集合。Adds the specified DesignerVerb to the collection. |
AddRange(DesignerVerb[]) |
向集合中添加指定的设计器谓词组。Adds the specified set of designer verbs to the collection. |
AddRange(DesignerVerbCollection) |
将指定的设计器谓词集合添加到集合中。Adds the specified collection of designer verbs to the collection. |
Clear() |
从 CollectionBase 实例移除所有对象。Removes all objects from the CollectionBase instance. 不能重写此方法。This method cannot be overridden. (继承自 CollectionBase) |
Contains(DesignerVerb) |
获取一个值,用以指示集合中是否存在指定的 DesignerVerb。Gets a value indicating whether the specified DesignerVerb exists in the collection. |
CopyTo(DesignerVerb[], Int32) |
从指定的目标索引开始,将集合成员复制到指定的 DesignerVerb 数组中。Copies the collection members to the specified DesignerVerb array beginning at the specified destination index. |
Equals(Object) |
确定指定对象是否等于当前对象。Determines whether the specified object is equal to the current object. (继承自 Object) |
GetEnumerator() |
返回循环访问 CollectionBase 实例的枚举器。Returns an enumerator that iterates through the CollectionBase instance. (继承自 CollectionBase) |
GetHashCode() |
作为默认哈希函数。Serves as the default hash function. (继承自 Object) |
GetType() |
获取当前实例的 Type。Gets the Type of the current instance. (继承自 Object) |
IndexOf(DesignerVerb) |
获取指定 DesignerVerb 的索引。Gets the index of the specified DesignerVerb. |
Insert(Int32, DesignerVerb) |
在指定索引处插入指定的 DesignerVerb。Inserts the specified DesignerVerb at the specified index. |
MemberwiseClone() |
创建当前 Object 的浅表副本。Creates a shallow copy of the current Object. (继承自 Object) |
OnClear() |
引发 |
OnClearComplete() |
在清除 CollectionBase 实例的内容之后执行其他自定义进程。Performs additional custom processes after clearing the contents of the CollectionBase instance. (继承自 CollectionBase) |
OnInsert(Int32, Object) |
引发 |
OnInsertComplete(Int32, Object) |
在向 CollectionBase 实例中插入新元素之后执行其他自定义进程。Performs additional custom processes after inserting a new element into the CollectionBase instance. (继承自 CollectionBase) |
OnRemove(Int32, Object) |
引发 |
OnRemoveComplete(Int32, Object) |
在从 CollectionBase 实例中移除元素之后执行其他自定义进程。Performs additional custom processes after removing an element from the CollectionBase instance. (继承自 CollectionBase) |
OnSet(Int32, Object, Object) |
引发 |
OnSetComplete(Int32, Object, Object) |
当在 CollectionBase 实例中设置值后执行其他自定义进程。Performs additional custom processes after setting a value in the CollectionBase instance. (继承自 CollectionBase) |
OnValidate(Object) |
引发 |
Remove(DesignerVerb) |
从集合中移除指定的 DesignerVerb。Removes the specified DesignerVerb from the collection. |
RemoveAt(Int32) |
移除 CollectionBase 实例的指定索引处的元素。Removes the element at the specified index of the CollectionBase instance. 此方法不可重写。This method is not overridable. (继承自 CollectionBase) |
ToString() |
返回表示当前对象的字符串。Returns a string that represents the current object. (继承自 Object) |
显式接口实现
ICollection.CopyTo(Array, Int32) |
从目标数组的指定索引处开始将整个 CollectionBase 复制到兼容的一维 Array。Copies the entire CollectionBase to a compatible one-dimensional Array, starting at the specified index of the target array. (继承自 CollectionBase) |
ICollection.IsSynchronized |
获取一个值,该值指示是否同步对 CollectionBase 的访问(线程安全)。Gets a value indicating whether access to the CollectionBase is synchronized (thread safe). (继承自 CollectionBase) |
ICollection.SyncRoot |
获取可用于同步对 CollectionBase 的访问的对象。Gets an object that can be used to synchronize access to the CollectionBase. (继承自 CollectionBase) |
IList.Add(Object) |
将对象添加到 CollectionBase 的结尾处。Adds an object to the end of the CollectionBase. (继承自 CollectionBase) |
IList.Contains(Object) |
确定 CollectionBase 是否包含特定元素。Determines whether the CollectionBase contains a specific element. (继承自 CollectionBase) |
IList.IndexOf(Object) |
搜索指定的 Object,并返回整个 CollectionBase 中第一个匹配项的从零开始的索引。Searches for the specified Object and returns the zero-based index of the first occurrence within the entire CollectionBase. (继承自 CollectionBase) |
IList.Insert(Int32, Object) |
将元素插入 CollectionBase 的指定索引处。Inserts an element into the CollectionBase at the specified index. (继承自 CollectionBase) |
IList.IsFixedSize |
获取一个值,该值指示 CollectionBase 是否具有固定大小。Gets a value indicating whether the CollectionBase has a fixed size. (继承自 CollectionBase) |
IList.IsReadOnly |
获取一个值,该值指示 CollectionBase 是否为只读。Gets a value indicating whether the CollectionBase is read-only. (继承自 CollectionBase) |
IList.Item[Int32] |
获取或设置指定索引处的元素。Gets or sets the element at the specified index. (继承自 CollectionBase) |
IList.Remove(Object) |
从 CollectionBase 中移除特定对象的第一个匹配项。Removes the first occurrence of a specific object from the CollectionBase. (继承自 CollectionBase) |
扩展方法
Cast<TResult>(IEnumerable) |
将 IEnumerable 的元素强制转换为指定的类型。Casts the elements of an IEnumerable to the specified type. |
OfType<TResult>(IEnumerable) |
根据指定类型筛选 IEnumerable 的元素。Filters the elements of an IEnumerable based on a specified type. |
AsParallel(IEnumerable) |
启用查询的并行化。Enables parallelization of a query. |
AsQueryable(IEnumerable) |
将 IEnumerable 转换为 IQueryable。Converts an IEnumerable to an IQueryable. |