开发者

Environment.NewLine equivalent for compact framework 2.0

开发者 https://www.devze.com 2023-01-31 08:08 出处:网络
What is the best practice for inserting a newline chara开发者_开发问答cter into a string in the .NET Compact Framework 2.0 SP2?Does the Compact Framework not support Environment.NewLine? Ah well. You

What is the best practice for inserting a newline chara开发者_开发问答cter into a string in the .NET Compact Framework 2.0 SP2?


Does the Compact Framework not support Environment.NewLine? Ah well. You can just use "\r\n" - if you know you're on the compact framework, it's not like you're running on Mono where the default new line may be different :)

You could 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
        }
    }
}
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号