I created a class with the responsibility to generate a text file where each line represents the information of an object of \'MyDataClass\' class. Below is a simplification
I had a similar issue. Environment.NewLine and WriteLine gave me extra \r character. But this below worked for me:
StringBuilder sbFileContent = new StringBuilder(); sbFileContent.Append(line); sbFileContent.Append("\n"); streamWriter.Write(sbFileContent.ToString());