C#.NET: How to Build Web URL Query Parameters
While working with Web API(s), especially those that require query parameter passing, it is often required to build those query parameters in order to attach them with the web URL. Asmak9.EssentialToolKit library provides many feature methods and building web URL query parameter is one of them.
Today, I shall be demonstrating building web URL query parameter method of Asmak9.EssentialToolKit .NET library using C#.NET console application.
Today, I shall be demonstrating building web URL query parameter method of Asmak9.EssentialToolKit .NET library using C#.NET console application.
Prerequisites:
Following are some prerequisites before you proceed any further in this tutorial:- Install Asmak9.EssentialToolKit Nuget Package.
- Knowledge of Nuget Package Manager.
- Knowledge of C# Programming.
Download Now!
Let's begin now.1) Create new C#.NET console application and name it "BuildUrlParams".
2) Open "Tools\Nuget Package Manage\Manage Nuget Packages for Solution...".
3) Install Asmak9.EssentialToolKit Nuget Package.
4) Now, create "BuildUrlParams.cs" file and type following lines of code i.e.
... // Initialization List<KeyValuePair<string, string>> lstParams = new List<KeyValuePair<string, string>>(); // Settings. lstParams.Add(new KeyValuePair<string, string>("param1", "val1")); lstParams.Add(new KeyValuePair<string, string>("param2", "val2")); lstParams.Add(new KeyValuePair<string, string>("param3", "val3")); // Build URL Query Parameters method utilityKit.BuildUrlParametersString(lstParams); ...
The above code shows how you can build your web URL query parameter by simply passing parameters key-value pair list. You also need to initialize 'UtilityKit' class with or without your license key.
5) Now, execute the project and you will be able to see the following i.e.
Post a Comment