System.Configuration.TypeUtil.GetTypeWithReflectionPermission C# (CSharp) Метод

GetTypeWithReflectionPermission() приватный Метод

private GetTypeWithReflectionPermission ( IInternalConfigHost host, string typeString, bool throwOnError ) : Type
host IInternalConfigHost
typeString string
throwOnError bool
Результат System.Type
        static internal Type GetTypeWithReflectionPermission(IInternalConfigHost host, string typeString, bool throwOnError) {
            Type type = null;
            Exception originalException = null;

            try {
                type = host.GetConfigType(typeString, throwOnError);
            }
            catch (Exception e) {
                originalException = e;
            }

            if (type == null) {
                type = GetLegacyType(typeString);
                if (type == null && originalException != null) {
                    throw originalException;
                }
            }

            return type;
        }

Same methods

TypeUtil::GetTypeWithReflectionPermission ( string typeString, bool throwOnError ) : Type

Usage Example

        internal bool IsEquivalentType(IInternalConfigHost host, string typeName)
        {
            try {
                if (_factoryTypeName == typeName)
                {
                    return(true);
                }

                Type t1, t2;

                if (host != null)
                {
                    t1 = TypeUtil.GetTypeWithReflectionPermission(host, typeName, false);
                    t2 = TypeUtil.GetTypeWithReflectionPermission(host, _factoryTypeName, false);
                }
                else
                {
                    t1 = TypeUtil.GetTypeWithReflectionPermission(typeName, false);
                    t2 = TypeUtil.GetTypeWithReflectionPermission(_factoryTypeName, false);
                }

                return((t1 != null) && (t1 == t2));
            }
            catch {
            }

            return(false);
        }
All Usage Examples Of System.Configuration.TypeUtil::GetTypeWithReflectionPermission