diff --git a/src/UriExtensions/UriExtensions.cs b/src/UriExtensions/UriExtensions.cs new file mode 100644 index 0000000..be5bab5 --- /dev/null +++ b/src/UriExtensions/UriExtensions.cs @@ -0,0 +1,18 @@ + +using System; +using System.Web; + +namespace EduitorNetCore.UriExtensionMethods +{ + public static class UriExtensions + { + public static Uri AddParameter(this Uri url, string paramName, string paramValue) + { + var uriBuilder = new UriBuilder(url); + var query = HttpUtility.ParseQueryString(uriBuilder.Query); + query[paramName] = paramValue; + uriBuilder.Query = query.ToString(); + return uriBuilder.Uri; + } + } +}