OpenSim.Framework.WebUtil.Combine C# (CSharp) Method

Combine() public static method

Combines a Uri that can contain both a base Uri and relative path with a second relative path fragment. If the fragment is absolute, it will be returned without modification
public static Combine ( this uri, Uri fragment ) : Uri
uri this Starting (base) Uri
fragment System.Uri Relative path fragment to append to the end /// of the Uri, or an absolute Uri to return unmodified
return System.Uri
        public static Uri Combine(this Uri uri, Uri fragment)
        {
            if (fragment.IsAbsoluteUri)
                return fragment;

            string fragment1 = uri.Fragment;
            string fragment2 = fragment.ToString();

            if (!fragment1.EndsWith("/"))
                fragment1 = fragment1 + '/';
            if (fragment2.StartsWith("/"))
                fragment2 = fragment2.Substring(1);

            return new Uri(uri, fragment1 + fragment2);
        }

Same methods

WebUtil::Combine ( this uri, string fragment ) : Uri