protected object CreateInstance(Type type)
{
Type[] typeArgs = new Type[] { typeof(Type) };
ConstructorInfo ctor = type.GetTypeInfo().GetConstructor(typeArgs);
if (ctor != null)
{
return TypeDescriptor.CreateInstance(null, type, typeArgs, new object[] { PropertyType });
}
return TypeDescriptor.CreateInstance(null, type, null, null);
}