System.TypeExtensionMethods.GetConstructor C# (CSharp) Method

GetConstructor() public static method

public static GetConstructor ( this type, Type types ) : ConstructorInfo
type this
types Type
return System.Reflection.ConstructorInfo
        public static ConstructorInfo GetConstructor(this Type type, Type[] types)
        {
            foreach(var constructor in type.GetTypeInfo().DeclaredConstructors)
            {
                var parameters = constructor.GetParameters();

                if(types.Length == parameters.Length)
                {
                    bool mismatch = false;
                    for(int i = 0; i < types.Length; i++)
                    {

                        if(types[i].FullName != parameters[i].ParameterType.FullName)
                        {
                            mismatch = true;
                            break;
                        }
                    }

                    if(!mismatch)
                    {
                        return constructor;
                    }
                }
            }
            return null;
        }
        public static MethodInfo GetMethod(this Type type, string name)