开发者

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

开发者 https://www.devze.com 2023-03-07 19:15 出处:网络
how do i declare a string with arguments inside? suppose string path = \"C:\\\\Work\\\\6.70_Extensions\\\\\"

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

精彩评论

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