Need help with String.Format
hi.
i have issue, need format string.
here's problem causing code snippet:
string formatstring = "mystring{{0},{1}}";
string arg1 = "value1";
string arg2 = "value2";
string result = string.format(formatstring, arg1, arg2);
result should "mystring{value1,value2}", formatexception.
so can see problem lies, string.format -method cannot handle format string. how can use format strings while @ same time include additional curly brackets result?
i have issue, need format string.
here's problem causing code snippet:
string formatstring = "mystring{{0},{1}}";
string arg1 = "value1";
string arg2 = "value2";
string result = string.format(formatstring, arg1, arg2);
result should "mystring{value1,value2}", formatexception.
so can see problem lies, string.format -method cannot handle format string. how can use format strings while @ same time include additional curly brackets result?
to include curly braces in formatted string, need type them twice in format string: string formatstring = "mystring{{{0},{1}}}";
Archived Forums V > Visual C# Language
Comments
Post a Comment