Редагувати

Поділитися через


ComponentCollection.Item[] Property

Definition

Gets any component in the collection matching the specified name.

Overloads

Item[Int32]

Gets the Component in the collection at the specified collection index.

Item[String]

Gets any component in the collection matching the specified name.

Item[Int32]

Source:
ComponentCollection.cs
Source:
ComponentCollection.cs
Source:
ComponentCollection.cs

Gets the Component in the collection at the specified collection index.

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

Parameters

index
Int32

The collection index of the Component to get.

Property Value

The IComponent at the specified index.

Exceptions

If the specified index is not within the index range of the collection.

Remarks

This method can be overridden by a derived class.

Applies to

Item[String]

Source:
ComponentCollection.cs
Source:
ComponentCollection.cs
Source:
ComponentCollection.cs

Gets any component in the collection matching the specified name.

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

Parameters

name
String

The name of the IComponent to get.

Property Value

A component with a name matching the name specified by the name parameter, or null if the named component cannot be found in the collection.

Remarks

This method can be overridden by a derived class.

This property returns an IComponent in the collection if its Site property is not null and the Name property of its Site property matches the specified string.

Note

This string indexer works only when the component is sited, which typically occurs only at design time. To site a Component at run time, set the Site property of the Component. The Name property of the ISite set to the Site property must also be set for this property to return the component.

See also

Applies to