Trying to format a string containing a bracket {
1: string id = "txtId";
2: StringBuilder sb = new StringBuilder();
3:
4: //Formatting this line, would give error: Input string was not in a correct format.
5: sb.AppendFormat("$("{0}").click(function () { ", id);
6:
7: sb.Append("$(this).slideUp();");
8: sb.Append("});");
The fix 1: string id = "txtId";
2: StringBuilder sb = new StringBuilder();
3:
4: //Adding another bracket, will do the trick
5: sb.AppendFormat("$("{0}").click(function () {{ ", id);
6:
7: sb.Append("$(this).slideUp();");
8: sb.Append("});");