Is there a way to use a tab character like a new line character inside the Environment class, instead of using "\t"?
-
What are you missing out with "\t"?Oskar Kjellin– Oskar Kjellin2010-04-21 21:06:13 +00:00Commented Apr 21, 2010 at 21:06
-
1@Oskar: That, I assume, is part of the question.SLaks– SLaks2010-04-21 21:07:13 +00:00Commented Apr 21, 2010 at 21:07
-
@SLaks, true. Probably he could have written that, although it seems very clear now that you've pointed it outOskar Kjellin– Oskar Kjellin2010-04-22 07:36:56 +00:00Commented Apr 22, 2010 at 7:36
-
1It's not in Environment but you could use (char)ConsoleKey.TabTod– Tod2012-02-01 23:12:57 +00:00Commented Feb 1, 2012 at 23:12
4 Answers
No.
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.
7 Comments
You can also use ControlChars.Tab.
2 Comments
Microsoft.VisualBasic namespace.If you really wanted to you, you could add a reference and use Microsoft.VisualBasic.Constants.vbTab. But the tab character is not something that changes based on your environment so System.Environment wouldn't have a property for you.
1 Comment
Are you looking for a pre-defined system constant for this (like Environment.NewLine)? There is no such thing as far as I know, but you could certainly create your own constant.
3 Comments
"a\tb" is much nicer than "a" + Environment.HorizontalTab + "b".