Environment.NewLine equivalent for compact framework 2.0
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
}
}
}
精彩评论