Skip to content

csharp use linq path

Adrian Sims edited this page Jan 18, 2020 · 2 revisions

First of all, let’s see how to print the PATH:

private static void PrintPath()
{
    // get variable or the empty string if the variable does not exist:
    var pathVariable = Environment.GetEnvironmentVariable("path") ?? "";

    pathVariable.Split(';').ToList().ForEach(Console.WriteLine);
}

Clone this wiki locally