System.Net.NetworkInformation.StringParsingHelpers.ParseAddressAndPort C# (CSharp) Method

ParseAddressAndPort() private static method

private static ParseAddressAndPort ( string colonSeparatedAddress ) : IPEndPoint
colonSeparatedAddress string
return IPEndPoint
        private static IPEndPoint ParseAddressAndPort(string colonSeparatedAddress)
        {
            int indexOfColon = colonSeparatedAddress.IndexOf(':');
            if (indexOfColon == -1)
            {
                throw ExceptionHelper.CreateForParseFailure();
            }

            string remoteAddressString = colonSeparatedAddress.Substring(0, indexOfColon);
            IPAddress ipAddress = ParseHexIPAddress(remoteAddressString);

            string portString = colonSeparatedAddress.Substring(indexOfColon + 1, colonSeparatedAddress.Length - (indexOfColon + 1));
            int port;
            if (!int.TryParse(portString, NumberStyles.HexNumber, CultureInfo.InvariantCulture, out port))
            {
                throw ExceptionHelper.CreateForParseFailure();
            }

            return new IPEndPoint(ipAddress, port);
        }