use Environment object to get Environment variable - CSharp Operating System

CSharp examples for Operating System:Environment

Description

use Environment object to get Environment variable

Demo Code

using System;/*from w  w w  .j a v  a 2 s.  c  o m*/
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
class Program
{
   static void Main(string[] args)
   {
      // Displaying components of Environment object
      Console.WriteLine("Device name: " + Environment.MachineName);
      Console.WriteLine("64-bit system: " + Environment.Is64BitOperatingSystem);
      Console.WriteLine("User name: " + Environment.UserName);
   }
}

Result


Related Tutorials