Reputation: 7672
The obvious doesn't catch the LF characters
foo.Replace(Environment.NewLine, String.Empty)
Nor does...
foo.Replace("\r\n", "").Replace("\n", "").Replace("\r", "")
The file itself is a multi line XML file. Line feed characters before the XML declaration invalidate the string.
Upvotes: 3
Views: 13799
Reputation: 85685
VB.NET doesn't use the C style escapes for CR or LF. In VB, your second example translates to:
foo.Replace(vbNewLine, replaceWith).Replace(vbLF, replaceWith).Replace(vbCR, replaceWith)
Upvotes: 7