예제 #1
0
 internal static bool TypeRequiresRegistrationHelper(Type type)
 {
     if (!type.IsClass && !type.IsValueType || type.IsAbstract || !type.IsValueType && type.GetConstructor(BindingFlags.Instance | BindingFlags.Public, (Binder)null, new Type[0], (ParameterModifier[])null) == (ConstructorInfo)null)
     {
         return(false);
     }
     return(Marshal.IsTypeVisibleFromCom(type));
 }
예제 #2
0
 internal static bool TypeRequiresRegistrationHelper(Type type)
 {
     if (!type.IsClass && !type.IsValueType)
     {
         return(false);
     }
     if (type.IsAbstract)
     {
         return(false);
     }
     if (!type.IsValueType && (type.GetConstructor(BindingFlags.Public | BindingFlags.Instance, null, new Type[0], null) == null))
     {
         return(false);
     }
     return(Marshal.IsTypeVisibleFromCom(type));
 }
        internal static bool TypeRequiresRegistrationHelper(Type type)
        {
            // If the type is not a class or a value class, then it does not get registered.
            if (!type.IsClass && !type.IsValueType)
            {
                return(false);
            }

            // If the type is abstract then it does not get registered.
            if (type.IsAbstract)
            {
                return(false);
            }

            // If the does not have a public default constructor then is not creatable from COM so
            // it does not require registration unless it is a value class.
            if (!type.IsValueType && type.GetConstructor(BindingFlags.Instance | BindingFlags.Public, null, new Type[0], null) == null)
            {
                return(false);
            }

            // All other conditions are met so check to see if the type is visible from COM.
            return(Marshal.IsTypeVisibleFromCom(type));
        }
예제 #4
0
 internal static bool TypeRequiresRegistrationHelper(Type type)
 {
     return((type.IsClass || type.IsValueType) && !type.IsAbstract && (type.IsValueType || !(type.GetConstructor(BindingFlags.Instance | BindingFlags.Public, null, new Type[0], null) == null)) && Marshal.IsTypeVisibleFromCom(type));
 }