C# 环境常量
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/294939/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Environment constants
提问by benPearce
Is there an equivalant to Environment.NewLine in DotNet for a Tab character?
对于 Tab 字符,DotNet 中的 Environment.NewLine 是否等效?
采纳答案by CMS
NewLine is on the Environment class because the new line specification varies between platforms:
NewLine 在 Environment 类上,因为新行规范因平台而异:
It's "\r\n" for non-Unix platforms and "\n" for Unix platforms. However tab is always "\t".
对于非 Unix 平台是“\r\n”,对于 Unix 平台是“\n”。但是制表符总是“\t”。
回答by Xiaofu
Short answer is: no, tab does not change between platforms as newline might, so there is no need for one.
简短的回答是:不,选项卡不会像换行符那样在平台之间改变,所以不需要一个。
Long answer is: technically, yes, you could use the one provided by VB in the Microsoft.VisualBasic.dll. I think it's Microsoft.VisualBasic.Constants.vbTab, but there's no good reason to use it in C# as I said above.
长答案是:从技术上讲,是的,您可以在 Microsoft.VisualBasic.dll 中使用 VB 提供的那个。我认为它是 Microsoft.VisualBasic.Constants.vbTab,但没有充分的理由在 C# 中使用它,正如我上面所说的。