A different way to create Uri Objects using Fluent Builder approach.
dotnet add package FluentUri
See more in https://www.nuget.org/packages/FluentUri/
We can modified any part of URI.
Example : Result -> https://localhost:443/?q=books+about+tennis&limit=10
new Fluri("google.com/")
.Add("q=books+about+OOP&limit=50")
.Over("q=books+about+tennis&limit=10")
.Scheme("https")
.Host("localhost")
.Port(443);
Available methods:
.Add("q=books+about+OOP&limit=50")
.Over("q=books+about+tennis&limit=10")
.Scheme("https")
.Host("localhost")
.Port(443);
.Fragment(42) or Fragment("test me")
.Path("/hey/you")
.Query("t=1")
.Remove("q")
.AddQuery(expandoObject)
Using Expando objects: Result -> http://google/?q=search&text=house&id=356
dynamic query = new ExpandoObject();
query.q = "search";
query.text = "house";
query.id = 356;
new Fluri("http://google/").AddQuery(query).GetUrl());
You can see all uses in https://github.com/Leanwit/Fluri/blob/master/test/Fluri/TestFluri.cs