diff --git a/ICD.Common.Utils/ReflectionUtils.cs b/ICD.Common.Utils/ReflectionUtils.cs index 2cd7c36..76b182b 100644 --- a/ICD.Common.Utils/ReflectionUtils.cs +++ b/ICD.Common.Utils/ReflectionUtils.cs @@ -260,6 +260,21 @@ namespace ICD.Common.Utils } } + /// + /// Creates an instance of the given type, calling the default constructor. + /// + /// + public static T CreateInstance(Type type) + { + if (type == null) + throw new ArgumentNullException("type"); + + if (!type.IsAssignableTo(typeof(T))) + throw new InvalidOperationException("Type is not assignable to T"); + + return (T)CreateInstance(type); + } + /// /// Gets the custom attributes added to the given assembly. ///