code_junkie

How to escape brackets in a format string in .Net

Nov 10th, 2011
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.20 KB | None | 0 0
  1. String val = "1,2,3"
  2. String.Format(" foo {{0}}", val);
  3.  
  4. string t = "1, 2, 3";
  5. string v = String.Format(" foo {{{0}}}", t); ;
  6.  
  7. string t = "1, 2, 3";
  8. string v = String.Format(" foo {{{0}}}", t);
Add Comment
Please, Sign In to add comment