Skip to content

Commit a8a647b

Browse files
committed
Converted back to lazy load
1 parent 570f9bf commit a8a647b

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/Simplify.System/ApplicationEnvironment.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ public static class ApplicationEnvironment
1818
// ReSharper disable once InconsistentNaming
1919
public const string DefaultEnvironmentName = "Production";
2020

21-
private static string _name = Environment.GetEnvironmentVariable(EnvironmentVariableName) ?? DefaultEnvironmentName;
21+
private static string? _name;
2222

2323
/// <summary>
2424
/// Gets or sets the current environment name.
@@ -28,7 +28,7 @@ public static class ApplicationEnvironment
2828
/// </value>
2929
public static string Name
3030
{
31-
get => _name;
31+
get { return _name ??= Environment.GetEnvironmentVariable(EnvironmentVariableName) ?? DefaultEnvironmentName; }
3232
set => _name = value ?? throw new ArgumentNullException(nameof(value));
3333
}
3434
}

0 commit comments

Comments
 (0)