Olvasás angol nyelven Szerkesztés

Megosztás a következőn keresztül:


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.

C#
public virtual System.ComponentModel.IComponent? this[int index] { get; }
C#
public virtual System.ComponentModel.IComponent this[int index] { get; }

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

.NET 10 és más verziók
Termék Verziók
.NET Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0, 2.1

Item[String]

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

Gets any component in the collection matching the specified name.

C#
public virtual System.ComponentModel.IComponent? this[string? name] { get; }
C#
public virtual System.ComponentModel.IComponent this[string name] { get; }

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.

Megjegyzés

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

.NET 10 és más verziók
Termék Verziók
.NET Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0, 2.1