Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Environment constants

Is there an equivalant to Environment.NewLine in DotNet for a Tab character?

like image 786
benPearce Avatar asked Nov 17 '08 05:11

benPearce


People also ask

What are examples of environmental variables?

SCRATCH is an example of an environment variable. When used as part of a command they need to be preceded by a '$', hence '$SCRATCH'. They are called environment variables because they are used to modify the environment in which some programs run on the central system.

How is environment variable defined?

An environment variable is a variable whose value is set outside the program, typically through functionality built into the operating system or microservice. An environment variable is made up of a name/value pair, and any number may be created and available for reference at a point in time.

What is the purpose of environment variables?

An environment variable is a dynamic "object" on a computer, containing an editable value, which may be used by one or more software programs in Windows. Environment variables help programs know what directory to install files in, where to store temporary files, and where to find user profile settings.


2 Answers

NewLine is on the Environment class because the new line specification varies between platforms:

It's "\r\n" for non-Unix platforms and "\n" for Unix platforms. However tab is always "\t".

like image 140
Christian C. Salvadó Avatar answered Oct 08 '22 22:10

Christian C. Salvadó


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.

like image 25
Xiaofu Avatar answered Oct 08 '22 23:10

Xiaofu