Use out var syntax

This commit is contained in:
teinarss
2020-08-16 10:49:33 +02:00
committed by Paul Chote
parent d52e4793fe
commit 27f1a7ab27
193 changed files with 395 additions and 826 deletions

View File

@@ -114,8 +114,7 @@ namespace OpenRA.Mods.Common.UpdateRules.Rules
{
ammoPool.RemoveNode(pipTypeNode);
string sequence;
if (PipReplacements.TryGetValue(pipTypeNode.Value.Value.ToLowerInvariant(), out sequence))
if (PipReplacements.TryGetValue(pipTypeNode.Value.Value.ToLowerInvariant(), out var sequence))
ammoPips.AddNode("FullSequence", sequence);
}
@@ -124,8 +123,7 @@ namespace OpenRA.Mods.Common.UpdateRules.Rules
{
ammoPool.RemoveNode(pipTypeEmptyNode);
string sequence;
if (PipReplacements.TryGetValue(pipTypeEmptyNode.Value.Value.ToLowerInvariant(), out sequence))
if (PipReplacements.TryGetValue(pipTypeEmptyNode.Value.Value.ToLowerInvariant(), out var sequence))
ammoPips.AddNode("EmptySequence", sequence);
}
@@ -252,9 +250,8 @@ namespace OpenRA.Mods.Common.UpdateRules.Rules
{
storesResources.RemoveNode(pipColorNode);
string sequence;
var type = pipColorNode.Value.Value.ToLowerInvariant();
if (type != "green" && PipReplacements.TryGetValue(type, out sequence))
if (type != "green" && PipReplacements.TryGetValue(type, out var sequence))
storagePips.AddNode("FullSequence", sequence);
}
else

View File

@@ -32,8 +32,7 @@ namespace OpenRA.Mods.Common.UpdateRules.Rules
var delayNode = dltt.LastChildMatching("Delay", false);
if (delayNode != null)
{
int delay;
if (Exts.TryParseIntegerInvariant(delayNode.Value.Value, out delay))
if (Exts.TryParseIntegerInvariant(delayNode.Value.Value, out var delay))
delayNode.ReplaceValue((delay * 1000 / 25).ToString());
}
}

View File

@@ -82,8 +82,7 @@ namespace OpenRA.Mods.Common.UpdateRules.Rules
var positionNode = node.LastChildMatching("ReferencePoint");
if (positionNode != null)
{
DecorationPosition value;
if (!PositionMap.TryGetValue(positionNode.NodeValue<LegacyReferencePoints>(), out value))
if (!PositionMap.TryGetValue(positionNode.NodeValue<LegacyReferencePoints>(), out var value))
value = DecorationPosition.TopLeft;
if (value != DecorationPosition.TopLeft)

View File

@@ -85,8 +85,7 @@ namespace OpenRA.Mods.Common.UpdateRules.Rules
if (projectileNode.Value.Value == null)
continue;
string[] fieldNames;
if (ProjectileFields.TryGetValue(projectileNode.Value.Value, out fieldNames))
if (ProjectileFields.TryGetValue(projectileNode.Value.Value, out var fieldNames))
{
foreach (var fieldName in fieldNames)
{