The requested page is not available for the requested platform. You are viewing the content for Default platform.

CRR0049 - Environment.NewLine can be used

This analyzer identifies "\r\n" string values which can be converted to Environment.NewLine calls to improve code readability and portability.

public string MakeText(params string[] data) {
    string result = data[0];
    for (int i = 1; i < data.Length; i++)
        result += "\r\n" + data[i];
    return result;
}

To fix the issue, convert the "\r\n" string value to the Environment.NewLine call:

public string MakeText(params string[] data) {
    string result = data[0];
    for (int i = 1; i < data.Length; i++)
        result += Environment.NewLine + data[i];
    return result;
}

Call the Use Environment.NewLine refactoring to replace the "\r\n" string with an Environment.NewLine constant reference.