See Also: CaptureCollection Members
The collection is immutable (read-only) and has no public constructor. The System.Text.RegularExpressions.CaptureCollection object contains one or more System.Text.RegularExpressions.Capture objects.
Instances of the System.Text.RegularExpressions.CaptureCollection class are returned by the following properties:
The Group.Captures property. Each member of the collection represents a substring captured by a capturing group. If a quantifier is not applied to a capturing group, the System.Text.RegularExpressions.CaptureCollection includes a single System.Text.RegularExpressions.Capture object that represents the same captured substring as the System.Text.RegularExpressions.Group object. If a quantifier is applied to a capturing group, the System.Text.RegularExpressions.CaptureCollection includes one System.Text.RegularExpressions.Capture object for each captured substring, and the System.Text.RegularExpressions.Group object provides information only about the last captured substring.
The Match.Captures property. In this case, the collection consists of a single System.Text.RegularExpressions.Capture object that provides information about the match as a whole. That is, the System.Text.RegularExpressions.CaptureCollection object provides the same information as the System.Text.RegularExpressions.Match object.
To iterate through the members of the collection, you should use the collection iteration construct provided by your language (such as foreach in C# and For Each…Next in Visual Basic) instead of retrieving the enumerator that is returned by the CaptureCollection.GetEnumerator method.