I am using String.Format and keep getting the error: Input String is Not in the Correct Format.
I have tried to eliminate different possibilities, but I cannot find the solution.
The solution must be a simple one, yet I cannot find it.
var peanuts = String.Format("{label: '{0}', legendEntry: true, data: { y: [new Date('{1}')], x: [new Date('{2}')], y1: [{3}] } }",
"name", "sync date", "download date", "100");
You have to escape any
{characters in your format string, else they will be interpreted as items to be formatted (replaced.)To insert a literal bracket
{you double it, like this{{.So your string would be:
See the Escaping Braces on the Composite Formatting MSDN page.