Share via


ComponentCollection.Item[] 屬性

定義

取得集合中符合指定名稱的所有元件。

多載

Item[Int32]

取得集合中指定集合索引上的 Component

Item[String]

取得集合中符合指定名稱的所有元件。

Item[Int32]

來源:
ComponentCollection.cs
來源:
ComponentCollection.cs
來源:
ComponentCollection.cs

取得集合中指定集合索引上的 Component

public:
 virtual property System::ComponentModel::IComponent ^ default[int] { System::ComponentModel::IComponent ^ get(int index); };
public virtual System.ComponentModel.IComponent? this[int index] { get; }
public virtual System.ComponentModel.IComponent this[int index] { get; }
member this.Item(int) : System.ComponentModel.IComponent
Default Public Overridable ReadOnly Property Item(index As Integer) As IComponent

參數

index
Int32

所要取得的 Component 集合索引。

屬性值

指定之索引處的 IComponent

例外狀況

如果所指定的索引並不位於集合的索引範圍中。

備註

這個方法可由衍生類別覆寫。

適用於

Item[String]

來源:
ComponentCollection.cs
來源:
ComponentCollection.cs
來源:
ComponentCollection.cs

取得集合中符合指定名稱的所有元件。

public:
 virtual property System::ComponentModel::IComponent ^ default[System::String ^] { System::ComponentModel::IComponent ^ get(System::String ^ name); };
public virtual System.ComponentModel.IComponent? this[string? name] { get; }
public virtual System.ComponentModel.IComponent this[string name] { get; }
member this.Item(string) : System.ComponentModel.IComponent
Default Public Overridable ReadOnly Property Item(name As String) As IComponent

參數

name
String

要取得之 IComponent 的名稱。

屬性值

名稱與 name 參數所指定名稱相符的元件,如果在集合中找不到具名的元件,則為 null

備註

這個方法可由衍生類別覆寫。

如果Site屬性不是 null ,而且NameSite 屬性的 屬性符合指定的字串,這個屬性就會傳回IComponent集合中的 。

注意

此字串索引器只有在元件月臺時才會運作,通常只會在設計時間發生。 若要在運行時間月臺 Component ,請設定 SiteComponent屬性。 Name也必須設定設為 Site 屬性的 ISite 屬性,這個屬性才能傳回元件。

另請參閱

適用於