A lot of people in C #. NET platform programming encountered a problem, that is, the text should be wrapped in a TextBox, save to the file but there is no newline.
For example:
The text in the TextBox is:
12
34
56
and saved to the file is:
123456
No line break.
The reason is:
The newline in the textbox is executed on the window, and a newline is required \ r \ n When it is executed, so it is not possible to break the line, so we can use a textbox. Text.replace ("\ n", "\ r \ n") to implement line breaks,
But in the Linux system and other platforms is a newline or other, so there is no guarantee that the software on each platform is correctly wrapped, we also have a solution, that is to use the environment class;
The property newline in the environment class can get a newline string defined for this environment. Then we can easily solve the problem of correct line-wrapping of each platform.
TextBox output line wrapping in C #