OleViewDotNet.COMRegistry.SecurityBinder.AllowedTypeOrAssembly C# (CSharp) Method

AllowedTypeOrAssembly() private method

private AllowedTypeOrAssembly ( Type type ) : bool
type System.Type
return bool
            private bool AllowedTypeOrAssembly(Type type)
            {
                // "Safe" types I guess, just let them through
                if (type.IsEnum || type.IsPrimitive || type == typeof(String))
                {
                    return true;
                }

                // Allow anything from this asssembly through.
                if (type.Assembly == typeof(COMRegistry).Assembly)
                {
                    return true;
                }

                string typeNamespace = type.Namespace.ToLower();
                switch (typeNamespace.ToLower())
                {
                    case "system":
                    case "system.collections":
                    case "system.collections.generic":
                        return true;
                }

                return false;
            }