Used to read from a string object.
Inheritance: ITextReader
示例#1
0
        /// <exception cref="InvalidOperationException"><c>InvalidOperationException</c>.</exception>
        private static void Test(string uriString)
        {
            var reader = new StringReader();
            reader.Assign(uriString);

            SipUri uri = Parse(reader);
            if (uri == null)
                throw new InvalidOperationException("Failed to parse: " + uriString);

            Assert.Equal(uriString, uri.ToString());
        }
示例#2
0
        /// <summary>
        /// Parse a message value.
        /// </summary>
        /// <param name="text">Text containg uri.</param>
        /// <returns>Newly created header.</returns>
        /// <exception cref="ParseException">Header value is malformed.</exception>
        /// <example>
        /// sip:[email protected]:5060
        /// [email protected]:5060
        /// jonas:[email protected]
        /// sip:[email protected]
        /// mailto:[email protected]
        /// </example>
        public static SipUri Parse(string text)
        {
            if (text == null)
                throw new ArgumentNullException("text");

            var reader = new StringReader(text);
            return Parse(reader);
        }