1.判断类型是否有无参构造函数
public static bool ContainsPublicParamlessCtor(Type type)
{
ConstructorInfo[] ctors = type.GetConstructors(BindingFlags.Public | BindingFlags.Instance);
for (int i = 0; i < ctors.Length; i++)
{
if (ctors[i].ToString().Contains(".ctor()"))
return true;
}
return false;
}
public static b