string str = "({{0}})";
int i = 0;
string str2 = string.Format(str, i++);
string str3 = string.Format(str, i++);
why is str3 ({0}) instead of ({1})?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You escaped the curly braces so they have no special meaning. From the documentation:
You can simplify your program and still demonstrate the problem:
Output:
See it working online: ideone
To get the desired output you need to use
{{followed by{0}and then finally}}: