0
嗨i'm解析aspx文件到XML和我有這樣的代碼:.NET替換()doesn't工作
if (lineLower.StartsWith("</asp:content>")) || (lineLower.StartsWith("</asp:Content>") && lineLower.EndsWith(">")))
{
temp += line.Replace(line, " ");
}
但這溫度+ = line.Replace(行,「「);只會在</asp:content>之前添加一個空格,而不是將其替換爲空格。
我需要使用不同的語法嗎?
究竟是你想達到什麼目的?你的IF邏輯看起來不穩定,根據LeZohan68的回答,這甚至不會編譯。 –
您沒有使用實際XML解析器的任何原因,例如[XmlDocument類](https://msdn.microsoft.com/en-us/library/system.xml.xmldocument%28v=vs.110%29的.aspx)? – freefaller
另外,不是'temp + = line.Replace(line,「」);'與'temp + =「」;「完全相同;''? – freefaller