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

@@ -27,8 +27,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
public ColorPickerLogic(Widget widget, ModData modData, World world, Color initialColor, string initialFaction, Action<Color> onChange,
Dictionary<string, MiniYaml> logicArgs)
{
string actorType;
if (initialFaction == null || !ChromeMetrics.TryGet("ColorPickerActorType-" + initialFaction, out actorType))
if (initialFaction == null || !ChromeMetrics.TryGet("ColorPickerActorType-" + initialFaction, out string actorType))
actorType = ChromeMetrics.Get<string>("ColorPickerActorType");
var preview = widget.GetOrNull<ActorPreviewWidget>("PREVIEW");
@@ -103,8 +102,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
var palettePresetRows = 2;
var paletteCustomRows = 1;
MiniYaml yaml;
if (logicArgs.TryGetValue("PaletteColumns", out yaml))
if (logicArgs.TryGetValue("PaletteColumns", out var yaml))
if (!int.TryParse(yaml.Value, out paletteCols))
throw new YamlException("Invalid value for PaletteColumns: {0}".F(yaml.Value));
if (logicArgs.TryGetValue("PalettePresetRows", out yaml))
@@ -189,9 +187,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
static float HueFromColor(Color c)
{
float h, s, v;
int a;
c.ToAhsv(out a, out h, out s, out v);
c.ToAhsv(out var a, out var h, out var s, out var v);
return h;
}