Refactorings that work with strings – Use Environment.NewLine
The Use Environment.NewLine refactoring is one of the simplest refactoring shipped in DevExpress Refactor! Pro which improves code portability. This refactoring replaces the “\r\n” string with the value of the Environment.NewLine property reference. The Environment.NewLine is a static string property from the System namespace that is tied to the current executing environment (platform). It returns a valid “line feed/carriage return” string that corresponds to the current operating system, for example: “\r\n” for Windows platforms, or a string containing just a line feed (“\n“) for Unix platforms.
You may use this refactoring to improve the portability of the code and readability. Consider the following code:
Applying this refactoring will help you replace all “\r\n” occurrences:
To learn more about the “Environment.NewLine can be used” code issue, please read the appropriate topic.
Also, refer to other refactorings that work with strings.—– Products: Refactor! Pro Versions: 11.1 and up VS IDEs: any Updated: Dec/02/2011 ID: R046