string.format throws FormatException.check this out.what is the problem

                        string noRepeatTemp =
                        "    private void {0}()\n" +
                        "    {\n{" +
                        "        toNextAnim(\"{1}\");\n" +
                        "    }\n";
                    if (!_isRepeated)
                    {
                        //throws exception here why?
                        string result = string.Format(noRepeatTemp, funcFinishedEventName, _nextClip);
                        return result;
                    }

PS:funcFinishedEventName and _nextClip are not null or empty…

Try escaping { and } with {{ and }}, i.e:

string noRepeatTemp =
  "    private void {0}()\n" +
  "    {{\n{{" +
  "        toNextAnim(\"{1}\");\n" +
  "    }}\n";

I tried it, worked very well, thx