GroupCollection.Item[] Property
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Enables access to a single member of the collection by integer or string index.
Overloads
| Name | Description |
|---|---|
| Item[Int32] |
Enables access to a member of the collection by integer index. |
| Item[String] |
Enables access to a member of the collection by string index. |
Item[Int32]
- Source:
- GroupCollection.cs
- Source:
- GroupCollection.cs
- Source:
- GroupCollection.cs
- Source:
- GroupCollection.cs
- Source:
- GroupCollection.cs
Enables access to a member of the collection by integer index.
public:
property System::Text::RegularExpressions::Group ^ default[int] { System::Text::RegularExpressions::Group ^ get(int groupnum); };
public System.Text.RegularExpressions.Group this[int groupnum] { get; }
member this.Item(int) : System.Text.RegularExpressions.Group
Default Public ReadOnly Property Item(groupnum As Integer) As Group
Parameters
- groupnum
- Int32
The zero-based index of the collection member to be retrieved.
Property Value
The member of the collection specified by groupnum.
Implements
Remarks
This property is the indexer of the GroupCollection class. It allows you to enumerate the members of the collection by using a foreach statement.
You can also use this property to retrieve individual captured groups by their index number. You can determine the number of items in the collection by retrieving the value of the Count property. Valid values for the groupnum parameter range from 0 to one less than the number of items in the collection.
If groupnum is not the index of a member of the collection, or if groupnum is the index of a capturing group that has not been matched in the input string, the method returns a Group object whose Success property is false and whose Group.Value property is Empty.
See also
Applies to
Item[String]
- Source:
- GroupCollection.cs
- Source:
- GroupCollection.cs
- Source:
- GroupCollection.cs
- Source:
- GroupCollection.cs
- Source:
- GroupCollection.cs
Enables access to a member of the collection by string index.
public:
property System::Text::RegularExpressions::Group ^ default[System::String ^] { System::Text::RegularExpressions::Group ^ get(System::String ^ groupname); };
public System.Text.RegularExpressions.Group this[string groupname] { get; }
member this.Item(string) : System.Text.RegularExpressions.Group
Default Public ReadOnly Property Item(groupname As String) As Group
Parameters
- groupname
- String
The name of a capturing group.
Property Value
The member of the collection specified by groupname.
Implements
Remarks
groupname can be either the name of a capturing group that is defined by the (?<name>) element in a regular expression, or the string representation of the number of a capturing group.
If groupname is not the name of a capturing group in the collection, or if groupname is the name of a capturing group that has not been matched in the input string, the method returns a Group object whose Success property is false and whose Group.Value property is Empty.