当针对System.Collections调用时,此代码不返回任何命名空间。
public static List<string> GetAssemblyNamespaces(AssemblyName asmName)
{
List<string> namespaces = new List<string>();
Assembly asm = Assembly.Load(asmName);
foreach (Type typ in asm.GetTypes())
if (typ.Namespace != null)
if (!namespaces.Contains(typ.Namespace))
namespaces.Add(typ.Namespace);
return namespaces;
}
为什么会这样呢?System.Collections 中有许多类型。我应该怎么办才能获取名称空间呢?