예제 #1
0
        /// <summary>
        /// Creates a URI interning it if interning is enabled via the <see cref="Options.InternUris">Options.InternUris</see>
        /// </summary>
        /// <param name="uri">String URI</param>
        /// <returns></returns>
        /// <remarks>
        /// When URI interning is disabled this is equivalent to just invoking the constructor of the <see cref="Uri">Uri</see> class
        /// </remarks>
        public static Uri Create(String uri)
        {
            Uri actualUri = null;

            if (Options.InternUris)
            {
                TrieNode <char, Uri> node = _uris.MoveToNode(uri);
                if (node.HasValue)
                {
                    return(node.Value);
                }
                else
                {
                    node.Value = new Uri(uri);
                    return(node.Value);
                }
            }
            else
            {
                return(new Uri(uri));
            }
        }