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

@@ -61,8 +61,7 @@ namespace OpenRA.Primitives
object Get(Type t, bool throwsIfMissing)
{
List<object> ret;
if (!data.TryGetValue(t, out ret))
if (!data.TryGetValue(t, out var ret))
{
if (throwsIfMissing)
throw new InvalidOperationException("TypeDictionary does not contain instance of type `{0}`".F(t));
@@ -76,8 +75,7 @@ namespace OpenRA.Primitives
public IEnumerable<T> WithInterface<T>()
{
List<object> objs;
if (data.TryGetValue(typeof(T), out objs))
if (data.TryGetValue(typeof(T), out var objs))
return objs.Cast<T>();
return new T[0];
}
@@ -94,8 +92,7 @@ namespace OpenRA.Primitives
void InnerRemove(Type t, object val)
{
List<object> objs;
if (!data.TryGetValue(t, out objs))
if (!data.TryGetValue(t, out var objs))
return;
objs.Remove(val);
if (objs.Count == 0)