Example #1
0
        public Uri GetValueAsUri()
        {
            if (m_type != ElementType.Url)
            {
                throw new InvalidOperationException(ErrorMsgNotUrlType);
            }
            System.Diagnostics.Debug.Assert(m_rawValue != null);
            Uri asUri = m_rawValue as Uri;

            if (asUri == null)
            {
                var    arr = m_rawValue as byte[];
                string str;
                if (arr != null)
                {
                    str = ServiceRecordParser.CreateUriStringFromBytes(arr);
                }
                else
                {
                    str = (string)m_rawValue;
                }
                asUri = new Uri(str);
            }
            return(asUri);
        }