StreamWriter.WriteLine write endofline terminator automatically, but It seems that the default endofline terminator for StreamWriter.WriteLine method is \r\n, is it possible to change it to \n for unix platform?
I'm running the code on Windows 10, Is it platform-related? Can I use StreamWriter.WriteLine to output a textfile with unix endofline terminator \n on Windows environment?
Here is my code:
using System;
using System.IO;
namespace ConsoleApp1
{
class Program
{
static void Main(string[] args)
{
StreamWriter sw = new StreamWriter("NewLineText.txt", true);
for (int i = 0; i < 3; i++)
{
sw.WriteLine("new line test" + i);
}
sw.Close();
}
}
}