Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the difference between ProcessStartInfo.EnvironmentVariables and ProcessStartInfo.Environment

ProcessStartInfo.EnvironmentVariables:

A string dictionary that provides environment variables that apply to this process and child processes.

ProcessStartInfo.Environment:

A generic dictionary containing the environment variables that apply to this process and its child processes.

On .NET Framework applications, using the Environment property is the same as using the EnvironmentVariables property.

And on not .NET Framework applications, what is the difference between ProcessStartInfo.EnvironmentVariables and ProcessStartInfo.Environment?

like image 583
baruchiro Avatar asked Apr 08 '26 13:04

baruchiro


1 Answers

They have different return types, but otherwise there is no functional difference.

According to this github issue, the .NET Core language designers wanted to use a standard IDictionary<> rather than the somewhat archaic StringDictionary used by the original EnvironmentVariables property. They couldn't change the return type of the existing property without breaking compatibility with .NET framework, so they added a new, mostly redundant, property.

like image 184
Darryl Avatar answered Apr 10 '26 04:04

Darryl



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!