StreamWriter end line with Lf rather than CrLf

Alec Sanger picture Alec Sanger · Jan 31, 2011 · Viewed 8.9k times · Source

I'm using StreamWriter to output a text file, but I would like to end my WriteLine with Lf rather than the default CrLf. Is there an easy way to do this using a parameter built into StreamWriter?

I feel like quite a moron right now, but I'll leave the question up here just for laughs. It's been a long day...

Answer

Matti Virkkunen picture Matti Virkkunen · Jan 31, 2011

It comes with a NewLine property for just that.