GroupCollection Class

[This documentation is for preview only, and is subject to change in later releases. Blank topics are included as placeholders.]

Returns the set of captured groups in a single match.

Inheritance Hierarchy

System. . :: . .Object
  System.Text.RegularExpressions..::..GroupCollection

Namespace:  System.Text.RegularExpressions
Assembly:  System.Text.RegularExpressions (in System.Text.RegularExpressions.dll)

Syntax

'Declaration
<SerializableAttribute> _
Public Class GroupCollection _
    Implements ICollection, IEnumerable
[SerializableAttribute]
public class GroupCollection : ICollection, 
    IEnumerable
[SerializableAttribute]
public ref class GroupCollection : ICollection, 
    IEnumerable
[<SerializableAttribute>]
type GroupCollection =  
    class
        interface ICollection
        interface IEnumerable
    end
public class GroupCollection implements ICollection, IEnumerable

The GroupCollection type exposes the following members.

Properties

  Name Description
Public property Count Returns the number of groups in the collection.
Public property IsReadOnly Gets a value that indicates whether the collection is read-only.
Public property IsSynchronized Gets a value that indicates whether access to the GroupCollection is synchronized (thread-safe).
Public property Item[ ( [ ( Int32] ) ] ) Enables access to a member of the collection by integer index.
Public property Item[ ( [ ( String] ) ] ) Enables access to a member of the collection by string index.
Public property SyncRoot Gets an object that can be used to synchronize access to the GroupCollection.

Top

Methods

  Name Description
Public method CopyTo Copies all the elements of the collection to the given array beginning at the given index.
Public method Equals(Object) Determines whether the specified Object is equal to the current Object. (Inherited from Object.)
Protected method Finalize Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.)
Public method GetEnumerator Provides an enumerator that iterates through the collection.
Public method GetHashCode Serves as a hash function for a particular type. (Inherited from Object.)
Public method GetType Gets the Type of the current instance. (Inherited from Object.)
Protected method MemberwiseClone Creates a shallow copy of the current Object. (Inherited from Object.)
Public method ToString Returns a string that represents the current object. (Inherited from Object.)

Top

Remarks

The collection is immutable (read-only) and has no public constructor. A GroupCollection object is returned by the Match..::..Groups property.

The collection contains one or more System.Text.RegularExpressions..::..Group objects. If the match is successful, the first element in the collection contains the Group object that corresponds to the entire match. Each subsequent element represents a captured group, if the regular expression includes capturing groups. If the match is unsuccessful, the collection contains a single System.Text.RegularExpressions..::..Group object whose Success property is false and whose Value property equals String..::..Empty.

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

See Also

Reference

System.Text.RegularExpressions Namespace