Using the generic type 'System.Collections.Generic.IEnumerable' requires '1' type arguments

Oct 12 2010 5:10 AM
Hi There

I'm getting the above error message for this block of code - I've bolded the line in question, can anyone tell what I'm missing? Thanks very much in advance, Paul.

internal class GroupIterator : IEnumerable
    {
        private Regex _regex;
        private string _input;

        public GroupIterator(string input, string pattern)
        {
            _regex = new Regex(pattern, UserDefinedFunctions.Options);
            _input = input;
        }

        public IEnumerator GetEnumerator()
        {
            int index = 0;
            Match current = null;
            string[] names = _regex.GetGroupNames();
            do
            {
                index++;
                current = (current == null) ?
                    _regex.Match(_input) : current.NextMatch();
                if (current.Success)
                {
                    foreach (string name in names)
                    {
                        Group group = current.Groups[name];
                        if (group.Success)
                        {
                            yield return new GroupNode(
                                index, name, group.Value);
                        }
                    }
                }
            }
            while (current.Success);
        }
    }

Answers (1)