以编程方式在.NET中使用制表符?制表符、方式、NET

2023-09-04 00:13:48 作者:你望穿秋水,我忘穿秋裤

有没有办法来使用,而不是使用制表符般的环境类中的新行字符,\ t的

Is there a way to use a tab character like a new line character inside Environment class, instead of using "\t"?

推荐答案

没有。

这是 Environment.NewLine 在所有存在的唯一理由是跨平台的问题,这对制表符所没有的。 换行字符是 \ r 上(pre-OS X)的Mac,在UNIX上,和 \ r \ñ在Windows上。 为了使净code是在这些平台之间移植时, Environment.NewLine 财产被创建,返回所使用的平台,你的$换行字符(S) C $ C上的。

The only reason that Environment.NewLine exists at all is cross-platform issues, which the tab character doesn't have. The newline character is \r on (Pre-OS X) Mac, \n on UNIX, and \r\n on Windows. To allow .Net code to be portable across these platforms, the Environment.NewLine property was created, to return the newline character(s) used by the platform your code is running on.

制表符在所有平台上的标准,所以没有点在作出财产归还。

The tab character is standard across all platforms, so there's no point in making a property to return it.