c# - How to get String.Format not to parse {0} -


i writing code generation tool have lines like

stringbuilder sp = new stringbuilder(); sp.appendformat("        public {0}textcolumn()\n", classname); sp.appendline("        {" sp.appendline("            column = new datagridviewtextboxcolumn();"); sp.appendformat("            column.datapropertyname = \"{0}\";\n", columnname); 

however issue having when run in line this.

sp.appendformat("return string.format(\"{0} = '{0}'\", cmblist.selectedvalue);", columnname); 

i want first {0} turn in whatever value of columnname want seccond {0} left alone internal string.format process correctly.

how do this?

use double curly braces:

string result = string.format("{{ignored}} {{123}} {0}", 543); 

Comments

Popular posts from this blog

c++ - How do I get a multi line tooltip in MFC -

asp.net - In javascript how to find the height and width -

c# - DataTable to EnumerableRowCollection -