簡體   English   中英

如何將值傳遞給以@開頭的c#參數

[英]How to pass values to c# parameters starting with @

嘗試傳遞值,但未取得進展。

場景:具有一個公共常量字符串,如下所示。

public const string ImageFile = @"http://xyz.com/scom/{0}?type={1}&wid={2}";

然后,我將獲得以上所需的0,1,2所需的相關值。

問題是如何將0,1,2的值傳遞給上述const字符串?

我的最終結果應該是這樣的

string mySTring = "http://xyz.com/scom/123?type=jpg&wid=200"

請提出建議。

謝謝。

使用String.Format

string ActualImageFile = String.Format(ImageFile, param1, param2, param3);
string.Format(@"http://xyz.com/scom/{0}?type={1}&wid={2}", param1, param2, param3);

應該做到的。

暫無
暫無

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

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