The following function displays some of the methods and properties of the Environment class of C#
static void ShowEnvironmentInfo()
{ Console.WriteLine("Commandline: {0}", Environment.CommandLine); Console.WriteLine("Current directory: {0}", Environment.CurrentDirectory); Console.WriteLine("Machine name: {0}", Environment.MachineName); Console.WriteLine("OS: {0}", Environment.OSVersion); Console.WriteLine("Userdomain name: {0}", Environment.UserDomainName); foreach (string drive in Environment.GetLogicalDrives()) Console.WriteLine("Drive: {0}", drive); Console.WriteLine("Number of processors: {0}", Environment.ProcessorCount); Console.WriteLine(".NET Version: {0}", Environment.Version); Console.WriteLine("Command arguments: {0}", Environment.GetCommandLineArgs()); }
|
No responses found. Be the first to respond and make money from revenue sharing program.
|