Finding all Namespaces in an assembly using Reflection (DotNET)

后端 未结 6 1066
滥情空心
滥情空心 2020-11-30 09:51

I\'ve got an assembly (loaded as ReflectionOnly) and I want to find all the namespaces in this assembly so I can convert them into \"using\" (\"Imports\" in VB) statements f

6条回答
  •  臣服心动
    2020-11-30 10:31

    You will have no other choice than iterating over all classes.

    Note that imports don't work recursively. "using System" won't import any classes from subnamespaces like System.Collections or System.Collections.Generic, instead you must include them all.

提交回复
热议问题