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,183
  • 2
  • 50
  • 72
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
  • 51,813
  • 12
  • 118
  • 151
-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
  • 5