Skip to content

Commit 2029e81

Browse files
Use TryGetValue to prevent double lookup and also shorten code
1 parent c7fc087 commit 2029e81

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

src/Servers/IIS/IntegrationTesting.IIS/src/IISDeployer.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,10 +86,9 @@ public override Task<DeploymentResult> DeployAsync()
8686
// For now, only support using published output
8787
DeploymentParameters.PublishApplicationBeforeDeployment = true;
8888
// Move ASPNETCORE_DETAILEDERRORS to web config env variables
89-
if (IISDeploymentParameters.EnvironmentVariables.ContainsKey(DetailedErrorsEnvironmentVariable))
89+
if (IISDeploymentParameters.EnvironmentVariables.TryGetValue(DetailedErrorsEnvironmentVariable, out var value))
9090
{
91-
IISDeploymentParameters.WebConfigBasedEnvironmentVariables[DetailedErrorsEnvironmentVariable] =
92-
IISDeploymentParameters.EnvironmentVariables[DetailedErrorsEnvironmentVariable];
91+
IISDeploymentParameters.WebConfigBasedEnvironmentVariables[DetailedErrorsEnvironmentVariable] = value;
9392

9493
IISDeploymentParameters.EnvironmentVariables.Remove(DetailedErrorsEnvironmentVariable);
9594
}

0 commit comments

Comments
 (0)