CollectionEditor 类

提供一个用户界面,该界面可以在设计时编辑大多数类型的集合。

**命名空间:**System.ComponentModel.Design
**程序集:**System.Design(在 system.design.dll 中)

语法

声明
Public Class CollectionEditor
    Inherits UITypeEditor
用法
Dim instance As CollectionEditor
public class CollectionEditor : UITypeEditor
public ref class CollectionEditor : public UITypeEditor
public class CollectionEditor extends UITypeEditor
public class CollectionEditor extends UITypeEditor

备注

给继承者的说明 此编辑器可以编辑具有 Item 属性的集合。此编辑器还可通过 Item 属性(如果存在)确定集合的类型。如果集合不具有此属性,或者您需要提供具有多种类型的集合,则可以重写此类的某些受保护成员,以将自定义此编辑器自定义为支持其他类型的集合。

示例

下面的代码示例使用一个 EditorAttributeCollectionEditor 与属性关联。

<EditorAttribute(GetType(System.ComponentModel.Design.CollectionEditor), GetType(System.Drawing.Design.UITypeEditor))>  _
Public Property testCollection() As ICollection
   Get
      Return Icollection
   End Get
   Set
      Icollection = value
   End Set
End Property
Private Icollection As ICollection
[EditorAttribute(typeof(System.ComponentModel.Design.CollectionEditor), typeof(System.Drawing.Design.UITypeEditor))]
public ICollection testCollection
{
    get
    {
        return Icollection;
    }
    set
    {
        Icollection = value;
    }
}
private ICollection Icollection;
public:
   [EditorAttribute(System::ComponentModel::Design::CollectionEditor::typeid,
      System::Drawing::Design::UITypeEditor::typeid)]
   property ICollection^ testCollection 
   {
      ICollection^ get()
      {
         return Icollection;
      }
      void set( ICollection^ value )
      {
         Icollection = value;
      }
   }
private:
   ICollection^ Icollection;
/** @attribute EditorAttribute(System.ComponentModel.Design.
    CollectionEditor.class, System.Drawing.Design.UITypeEditor.class)
 */
/** @property 
 */
public ICollection get_TestCollection()
{
    return iCollection;
} //get_TestCollection

/** @property 
 */
public void set_TestCollection(ICollection value)
{
    iCollection = value;
} //set_TestCollection

private ICollection iCollection;

继承层次结构

System.Object
   System.Drawing.Design.UITypeEditor
    System.ComponentModel.Design.CollectionEditor
       派生类

线程安全

此类型的任何公共静态(Visual Basic 中的 Shared)成员都是线程安全的,但不保证所有实例成员都是线程安全的。

平台

Windows 98、Windows 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

.NET Framework 并不是对每个平台的所有版本都提供支持。有关受支持版本的列表,请参见系统要求

版本信息

.NET Framework

受以下版本支持:2.0、1.1、1.0

请参见

参考

CollectionEditor 成员
System.ComponentModel.Design 命名空间
UITypeEditor