list = new Group [n];
}
- public virtual int Count {
+ public int Count {
get { return list.Length; }
}
get { return true; }
}
- public virtual bool IsSynchronized {
+ public bool IsSynchronized {
get { return false; }
}
public Group this [string groupName] {
get {
- foreach (Group g in list) {
- if (!(g is Match))
- continue;
-
- int index = ((Match)g).Regex.GroupNumberFromName (groupName);
+ // The 0th group is the match.
+ Match m = (Match) list [0];
+ if (m != Match.Empty) {
+ int index = m.Regex.GroupNumberFromName (groupName);
if (index != -1)
return this [index];
}
}
}
- public virtual object SyncRoot {
+ public object SyncRoot {
get { return list; }
}
- public virtual void CopyTo (Array array, int index)
+ public void CopyTo (Array array, int index)
{
list.CopyTo (array, index);
}
- public virtual IEnumerator GetEnumerator ()
+ public IEnumerator GetEnumerator ()
{
return list.GetEnumerator ();
}