SyntaxFix
Write A Post
Hire A Developer
Questions
This will trim off any combination of carriage returns and newlines from the end of s:
s
s = s.TrimEnd(new char[] { '\r', '\n' });
Edit: Or as JP kindly points out, you can spell that more succinctly as:
s = s.TrimEnd('\r', '\n');