Fix CA1854

This commit is contained in:
RoosterDragon
2023-11-15 19:46:36 +00:00
committed by Pavel Penev
parent c2568ebd1f
commit c8efc5fdd7
19 changed files with 44 additions and 48 deletions

View File

@@ -152,8 +152,8 @@ namespace OpenRA
for (var i = 0; i < p.Length; i++)
{
var key = p[i].Name;
if (!args.ContainsKey(key)) throw new InvalidOperationException($"ObjectCreator: key `{key}' not found");
a[i] = args[key];
if (!args.TryGetValue(key, out var arg)) throw new InvalidOperationException($"ObjectCreator: key `{key}' not found");
a[i] = arg;
}
return ctor.Invoke(a);