Get environment variable for current process in CSharp

Description

The following code shows how to get environment variable for current process.

Example


using System;/*from   w  ww . j a  v  a2  s  .c o m*/
using System.Collections;
using Microsoft.Win32;

class Sample 
{
    public static void Main(){
        string str = Environment.GetEnvironmentVariable("SAMPLE",
             EnvironmentVariableTarget.Process);
        Console.WriteLine(str);
    }

}




















Home »
  C# Tutorial »
    Development »




Console
Encoding
Environment
Random