Environment.NewLine equivalent for compact structure 2.0

What is the best practice for inserting a newline into a string in .NET Compact Framework 2.0 SP2?

+3
source share
1 answer

Does it support Compact Framework Environment.NewLine? Oh, good. You can just use it "\r\n"- if you know that you are in a compact structure, it is not like you are working in Mono, where the new line by default may be different :)

You can always create your own string property:

public static class PortableEnvironment
{
    public static string NewLine
    {
        get
        {
#if COMPACT_FRAMEWORK
            return "\r\n";
#else
            return Environment.NewLine;
#endif
        }
    }
}
+7
source

Source: https://habr.com/ru/post/1780939/


All Articles