C# string replacement , not working

后端 未结 6 1561
悲哀的现实
悲哀的现实 2020-12-07 03:47

I have a string which I read in from :

TextReader tr = new StreamReader(this.dataPath );
string contents = tr.ReadToEnd(); 

The value of co

6条回答
  •  悲&欢浪女
    2020-12-07 04:41

    you probably want to do this:

    string styleSheet = "";
    string xmlString = "";
    TextReader tr = new StreamReader(this.dataPath );
    string contents = tr.ReadToEnd(); 
    string result = contents.Replace(xmlString,xmlString + styleSheet );
    

    You're currently not capturing the replace results that you're doing on the last line.

提交回复
热议问题