Replace Single with First when we know the element count is 1 (#15676)

This commit is contained in:
xtqqczze 2021-06-26 01:19:05 +01:00 committed by GitHub
parent 7a39acb527
commit 1e992c5e53
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 3 additions and 3 deletions

View file

@ -105,7 +105,7 @@ namespace Microsoft.PowerShell.Cmdletization.Cim
if (cmdletOutput.Count == 1) if (cmdletOutput.Count == 1)
{ {
var singleOutputParameter = cmdletOutput.Values.Single(); var singleOutputParameter = cmdletOutput.Values.First();
if (singleOutputParameter.Value == null) if (singleOutputParameter.Value == null)
{ {
return; return;

View file

@ -202,7 +202,7 @@ namespace Microsoft.PowerShell.Cmdletization.Cim
if (valueBehaviors.Count == 1) if (valueBehaviors.Count == 1)
{ {
this.BehaviorOnNoMatch = valueBehaviors.Single(); this.BehaviorOnNoMatch = valueBehaviors.First();
} }
else else
{ {

View file

@ -1983,7 +1983,7 @@ Microsoft.PowerShell.Core\Export-ModuleMember -Function '{1}' -Alias '*'
} }
else if (queryParameterSets.Count == 1) else if (queryParameterSets.Count == 1)
{ {
commandMetadata.DefaultParameterSetName = queryParameterSets.Single(); commandMetadata.DefaultParameterSetName = queryParameterSets[0];
} }
AddPassThruParameter(commonParameters, instanceCmdlet); AddPassThruParameter(commonParameters, instanceCmdlet);