簡體   English   中英

如何在 http 客戶端 c# 上添加路徑參數

[英]how to add Path Parameter on http client c#

how to add Path Parameter on http client c# url example https://testurl/accounts/product/:productid/user/:userid?fields=Attributes

我嘗試使用 KeyValuePair 添加但沒有運氣。

在此處輸入圖像描述

您可以使用字符串插值和連接。 我認為這就是您所要求的;

        int userId = 1;
        string url = $"https://testurl/accounts/product/:productid/user/{userId}";
       // Add here if there is any condtion if() or any loop
        url += "?fields=Attributes";

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM