Thursday, 15 May 2014

c# - When using brackets in String: "Input string was not in a correct format" -



c# - When using brackets in String: "Input string was not in a correct format" -

this question has reply here:

how escape braces (curly brackets) in format string in .net 4 answers

how can format string in c# pattern has brackets? when run next statement...

string.format("foo { bar={0} }", this.bar);

... receive runtime exception:

system.formatexception: input string not in right format.

should have escape brackets? how to?

escape brackets doubling brackets {{ , }}

string.format("foo {{ bar={0} }}", this.bar);

c# string c#-4.0 string-formatting

No comments:

Post a Comment