Skip to content

Commit

Permalink
env vars fix
Browse files Browse the repository at this point in the history
  • Loading branch information
DomCR committed Apr 29, 2024
1 parent 07c9cc4 commit e2145b3
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions CSUtilities/EnvironmentVars.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,11 @@ public static string Get(string name, EnvironmentVariableTarget target)
public static T Get<T>(string name)
{
string value = Environment.GetEnvironmentVariable(name, EnvironmentVariableTarget.Process);
if (value == null)
{
return default;
}

return (T)TypeDescriptor.GetConverter(typeof(T)).ConvertFromInvariantString(value);
}

Expand Down

0 comments on commit e2145b3

Please sign in to comment.