From bcf13ef97217f39714a43f818583372cb80e4be2 Mon Sep 17 00:00:00 2001 From: Chris Cameron Date: Mon, 1 Apr 2019 14:16:56 -0400 Subject: [PATCH] perf: Optimizing object instantiation for default constructors --- ICD.Common.Utils/ReflectionUtils.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ICD.Common.Utils/ReflectionUtils.cs b/ICD.Common.Utils/ReflectionUtils.cs index 542533f..fd8ee62 100644 --- a/ICD.Common.Utils/ReflectionUtils.cs +++ b/ICD.Common.Utils/ReflectionUtils.cs @@ -220,6 +220,9 @@ namespace ICD.Common.Utils if (parameters == null) throw new ArgumentNullException("parameters"); + if (parameters.Length == 0) + return Activator.CreateInstance(type); + ConstructorInfo constructor = GetConstructor(type, parameters); try