Can I change the value of Environment.NewLine?
Not. If you know which platform to write to, create classes for each of these platforms and let them have their own implementation. In the simplest case, it would look like this:
public abstract class Platform { public abstract string Newline { get; } } public sealed class Unix : Platform { public override string Newline { get { return "\n"; } } }
etc., and then just use an instance of the corresponding class.
Konrad Rudolph
source share