Container.Add 方法

定義

Component 加入至 ContainerAdds a Component to the Container.

多載

Add(IComponent)

將指定的 Component 加入至 ContainerAdds the specified Component to the Container. 元件未命名。The component is unnamed.

Add(IComponent, String)

將指定的 Component 加入 Container,並指派名稱給它。Adds the specified Component to the Container and assigns it a name.

Add(IComponent)

將指定的 Component 加入至 ContainerAdds the specified Component to the Container. 元件未命名。The component is unnamed.

public:
 virtual void Add(System::ComponentModel::IComponent ^ component);
public virtual void Add (System.ComponentModel.IComponent component);
abstract member Add : System.ComponentModel.IComponent -> unit
override this.Add : System.ComponentModel.IComponent -> unit
Public Overridable Sub Add (component As IComponent)

參數

component
IComponent

要加入的元件。The component to add.

實作

例外狀況

componentnullcomponent is null.

備註

衍生類別可以覆寫這個方法。This method can be overridden by a derived class.

新的 Component 會新增至清單的結尾。The new Component is added to the end of the list.

另請參閱

Add(IComponent, String)

將指定的 Component 加入 Container,並指派名稱給它。Adds the specified Component to the Container and assigns it a name.

public:
 virtual void Add(System::ComponentModel::IComponent ^ component, System::String ^ name);
public virtual void Add (System.ComponentModel.IComponent component, string name);
abstract member Add : System.ComponentModel.IComponent * string -> unit
override this.Add : System.ComponentModel.IComponent * string -> unit
Public Overridable Sub Add (component As IComponent, name As String)

參數

component
IComponent

要加入的元件。The component to add.

name
String

要指派給元件的唯一、不區分大小寫的名稱。The unique, case-insensitive name to assign to the component.

-或--or- null,表示沒有為元件命名。null, which leaves the component unnamed.

實作

例外狀況

componentnullcomponent is null.

name 不是唯一。name is not unique.

備註

衍生類別可以覆寫這個方法。This method can be overridden by a derived class.

新的 Component 會新增至清單的結尾。The new Component is added to the end of the list.

另請參閱

適用於