在.NET中以编程方式使用制表符 [英] Programmatically using a tab character in .NET

查看:84
本文介绍了在.NET中以编程方式使用制表符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有一种方法可以在环境类,而不是使用 \t

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

推荐答案

否。

Environment.NewLine 完全存在的唯一原因是平台问题,而制表符则没有。
(在OS X之前的版本)上,换行符为 \r ,在Mac上为 \n Unix和Windows上的 \r\n

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.

允许.NET代码在这些代码之间可移植平台上,创建了 Environment.NewLine 属性,以返回代码在其上运行的平台所使用的换行符。

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.

这篇关于在.NET中以编程方式使用制表符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆