String.Remove doesn't work

c#

Solution

It does, it just doesn't affect the actual string, it creates a new one as a result. Use:

Gen_ParamFile = Gen_ParamFile.Remove(0, Length);

Problem

I have such code and can't understand where is the mistake, despite the fact, that this code pretty easy. So `q` is a full path, and I need to get required path to `Gen_ParamFile` ``` string q = @"C:\ProgramData\RadiolocationQ\script-Data=12^6-12^33.xml"; string _directoryName1 = @"C:\ProgramData\RadiolocationQ"; int Length = _directoryName1.Length + "ascript".Length; string Gen_ParamFile = q; Gen_ParamFile.Remove(0, Length); // this line don't do anything var Gen_Parfile = Path.Combine(_directoryName1, "GeneralParam-Data" + Gen_ParamFile); ``` I used function like said here http://msdn.microsoft.com/ru-ru/library/9ad138yc(v=vs.110).aspx

Original source

Related problems