0

I though it was simple. but I didn't manage to make this line of code add "\Game_Progress.xml" to my String code_file.Insert(code_file.Length, "\\Game_Progress.xml");

R. Oosterholt
  • 7,720
  • 2
  • 53
  • 77
jjm
  • 13
  • 1
  • Possible duplicate of [Why .NET String is immutable?](http://stackoverflow.com/questions/2365272/why-net-string-is-immutable) – ivan_pozdeev Apr 10 '16 at 21:52

2 Answers2

1

You can append the string using the += operator:

code_file += "\\Game_Progress.xml";

Note: If you want to combine a path, you should consider using the Path Combine method:

System.IO.Path.Combine(code_file, "\\Game_Progress.xml")
Martin Brandl
  • 56,134
  • 13
  • 133
  • 172
-1

C# can require an @prior to the string when using backslashes. Try:

code_file.Insert(code_file.Length, @"\\Game_Progress.xml");

Ed Jones
  • 104
  • 6