System.Net.Mail.MailAddressParser.ParseDomain C# (CSharp) Method

ParseDomain() private static method

private static ParseDomain ( string data, int &index ) : string
data string
index int
return string
        private static string ParseDomain(string data, ref int index)
        {
            // Skip comments and whitespace
            index = ReadCfwsAndThrowIfIncomplete(data, index);

            // Mark one end of the domain component
            int startingIndex = index;

            // Is the domain component in domain-literal format or dot-atom format?
            if (data[index] == MailBnfHelper.EndSquareBracket)
            {
                index = DomainLiteralReader.ReadReverse(data, index);
            }
            else
            {
                index = DotAtomReader.ReadReverse(data, index);
            }

            string domain = data.Substring(index + 1, startingIndex - index);

            // Skip comments and whitespace
            index = ReadCfwsAndThrowIfIncomplete(data, index);

            return NormalizeOrThrow(domain);
        }