UriBuilder builder = new UriBuilder("https://www.example.com"); Console.WriteLine(builder.ToString()); // output: https://www.example.com/
UriBuilder builder = new UriBuilder("https://www.example.com/search"); builder.Query = "q=csharp"; Console.WriteLine(builder.ToString()); // output: https://www.example.com/search?q=csharpIn this example, we create an instance of the UriBuilder class with the path set to "/search". We then modify the query string by setting the Query property to "q=csharp". The ToString method returns the full URI string, including the modified query string. Overall, the UriBuilder class is a useful tool for creating and modifying URIs in C#. Its ToString method allows for easy retrieval of the full URI string. It is part of the System namespace in the .NET Framework Base Class Library.