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

windows - Why does Vista not allow creation of shortcuts to "Programs" on a NonAdmin account? Not supposed to install apps from NonAdmin account? -

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

unit testing - How to mock PreferenceManager in Android? -