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;
}