Skip to content
David Cumps

Group Class and GroupCollection Class

Part of my 2008 study notes for exam 70-536 (.NET Framework 2.0).

Overview

  • Contains the named and unnamed results of matches in a regex.
    • Unnamed results are numbered starting from 1.

Examples

Scanning Text

string input = "The dog ate a bone.";
string regex = @"^The (?<animal>\w+)\b ate (?<food>.+)\.$";
 
Match m = Regex.Match(input, regex);
Console.WriteLine(string.Format("Animal: {0}, Food: {1}!", m.Groups["animal"], m.Groups[2]));

You May Also Like

ArrayList Class

Resizeable, unordered, index-based collection. Suffers from boxing/unboxing when working with value types. Implements IEnumerator, allowing foreach…

BitArray Class

Contains an array of true/false values. Resizable through the Length property. Supports bitwise operations.