UriHelper.Combine Method
- Namespace
- Kampute.DocToolkit.Support
- Assembly
Definition
Creates a new
Uri by combining the
Uri with a relative URI string.
public static Uri Combine(this Uri baseUri, string relativeUri)
Parameters
baseUri Uri- The base Uri instance.
relativeUri string- The relative URI string to combine with the base URI.
Returns
- Uri
- A new Uri that represents the combination of the base Uri and the relative URI string.
Exceptions
- ArgumentNullException
- Thrown when
baseUri is null. - ArgumentException
- Thrown when
relativeUri attempts to navigate beyond the root directory.
See Also
- Path–If the path of
- Query–The query string of the resulting URI is a combination of the base URI's query string and the relative URI's query string.
- Fragment–If
There are some differences between URIs created using this method and those created using the Uri(Uri, string) constructor:relativeUristarts with a forward slash, it replaces the base URI's path; otherwise, it is appended to the base URI's path.relativeUricontains a fragment, it replaces the base URI's fragment; otherwise, the base URI's fragment is preserved.