UriHelper.WithQueryParameter Method
- Namespace
- Kampute.DocToolkit.Support
- Assembly
- Kampute.DocToolkit.dll
Definition
Creates a new Uri with the specified query parameter added.
public static Uri WithQueryParameter(this Uri uri, string paramName, string paramValue)Parameters
uriUri- The Uri instance to append the query parameter to.
paramNamestring- The name of the query parameter.
paramValuestring- The value of the query parameter, which will be URI-encoded.
Returns
Exceptions
- ArgumentNullException
- Thrown when
uriorparamValueisnull. - ArgumentException
- Thrown when
paramNameisnullor empty.
Remarks
This method creates a new Uri instance with the specified query parameter added to the original URI. If the original URI already contains a query string with the same parameter name, rather than replacing it, the method appends the new parameter to the existing query string.
