开发者

how do i declare a string with arguments parsed from commandline?

how do i declare a string with arguments inside?

suppose

string path = "C:\\Work\\6.70_Extensions\\"

and 6.70_Extensions is开发者_运维问答 replaced by args parsed i tried this:

string path = ("C:\\Work\\{0}\\NightlyBuild\\", args[0]) ;

where args[0] is a string. I suppose my syntax is wrong somewhere


You should be using string.Format for that.

string path = string.Format("C:\\Work\\{0}\\NightlyBuild\\", args[0]) ;


You're looking for String.Format:

string path = String.Format("C:\\Work\\{0}\\NightlyBuild\\", args[0]);

or simple concatenation (after a null check, of cource):

string path = "C:\\Work\\" + args[0] + "\\NightlyBuild\\";
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜