Skip to content

hklemp/UriBuilderExtensions

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

UriBuilderExtensions

NuGet version (UriBuilderExtension) Build Status

Extension for the .net UriBuilder to simply extend the query

Basics:

  • Add the nuget Package to your Project
  • Add Using eg. using UriBuilderExtension;

Usage


To add a query parameter use the method `SetQueryParam``

UriBuilder uriBuilder = new UriBuilder();
           uriBuilder.Scheme = "https";
           uriBuilder.Host = "www.google.com";
           uriBuilder.Path = "search";
           // The magic happens here  
           uriBuilder.SetQueryParam("q", "query+goes+here");
           // or 
           uriBuilder.SetQueryParam("p", new String[] {"here" ,"and+here"});

If you want to check is a parameter exsit in the query use

bool exsists = uriBuilder.HasQueryParam("p")

To get the value/values of a parameter use

var value = uriBuilder.GetQueryParamValue("p")

To get all parameter keys of the query use

var value = uriBuilder.GetQueryParamKeys();

To Remove one parameter use

uriBuilder.RemoveQueryParam("q");

About

Extension for the .net UriBuilder to simply extend the query

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors