Change to use pattern matching

This commit is contained in:
teinarss
2021-02-28 19:00:32 +01:00
committed by reaperrr
parent 7c0e4b25ae
commit d60c05eff3
35 changed files with 63 additions and 122 deletions

View File

@@ -63,13 +63,11 @@ namespace OpenRA
sb.AppendIndentedFormatLine(indent, "Exception of type `{0}`: {1}", ex.GetType().FullName, ex.Message);
var tle = ex as TypeLoadException;
var oom = ex as OutOfMemoryException;
if (tle != null)
if (ex is TypeLoadException tle)
{
sb.AppendIndentedFormatLine(indent, "TypeName=`{0}`", tle.TypeName);
}
else if (oom != null)
else if (ex is OutOfMemoryException)
{
var gcMemoryBeforeCollect = GC.GetTotalMemory(false);
GC.Collect();