Probe into the source--system.environment of class library

Source: Internet
Author: User

Environment class: Provides information about the current environment and platform and how to manipulate them. This class cannot be inherited.

Namespaces: System

Assembly: mscorlib.dll

Inheritance Relationship:

Common Properties (Fields) and methods:

CurrentDirectory Gets or sets the fully qualified path of the current working directory

OSVersion gets the OperatingSystem object that contains the current platform identifier and version number.

GetLogicalDrives returns an array of strings containing the names of logical drives in the current computer.

GetFolderPath (environment.specialfolder) Gets the path to the System special folder identified by the specified enumeration.

Environment.SpecialFolder enumeration: Specifies the enumeration constants that are used to retrieve the directory path of the system special folder.

Namespaces: System

Assembly: mscorlib.dll

Commonly used special folder enumeration values:

Desktop logical desktops, not physical file system locations.

Programs contains a directory of user program groups.

ProgramFiles the "Program Files" directory.

More enumeration values See MSDN

Example:

1 usingSystem;2 3 classApp4 {5     Static voidMain ()6     {7 Console.WriteLine (environment.currentdirectory);8 Console.WriteLine (environment.osversion);9 Console.WriteLine (Environment.getfolderpath (Environment.SpecialFolder.Desktop));Ten Console.WriteLine (Environment.getfolderpath (Environment.SpecialFolder.Programs)); One Console.WriteLine (Environment.getfolderpath (Environment.SpecialFolder.ProgramFiles));  A          -         varDrivers =environment.getlogicaldrives (); -         foreach(varDinchdrivers) the         { - Console.WriteLine (d); -         } -          +     } -}

Effect:

Probe into the source--system.environment of class library

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.