UriBuilder builder = new UriBuilder("http://www.example.com"); builder.AppendQuery("q=hello"); Console.WriteLine(builder.Uri.ToString()); // Output: http://www.example.com?q=hello
UriBuilder builder = new UriBuilder("http://www.example.com"); builder.AppendQuery("q=hello"); builder.AppendQuery("lang=en"); Console.WriteLine(builder.Uri.ToString()); // Output: http://www.example.com?q=hello&lang=enIn this example, we create a new UriBuilder object with the base URI "http://www.example.com". We then call the AppendQuery() method twice, each with a separate query string parameter. The resulting URI is printed to the console. Package Library: System.Runtime.Extensions. This package contains a set of extension methods and helper classes for working with the .NET runtime. The UriBuilder class is part of this library.