private object CreateInstance(Type type) {
if ((!(type.IsPublic || type.IsNestedPublic)) && (type.Assembly == typeof(DebugTypeDescriptor).Assembly)) {
IntSecurity.FullReflection.Demand();
}
ConstructorInfo ctor = type.GetConstructor(typeConstructor);
if (ctor != null) {
return ctor.Invoke(new object[] {componentType});
}
return Activator.CreateInstance(type, BindingFlags.Instance | BindingFlags.Public | BindingFlags.CreateInstance, null, null, null);
}