Type.GetType()与System.Web.Compilation.BuildManager.GetType()

    在同一个Assembly中,用 Type.GetType("类名"),就能得到这个类类型,但是如果是跨 Assembly时,你必须 Type.GetType("类名,Assembly名称"),必须把你的Assembly名称加进去,否则得到的是Null。不过最近发现 System.Web.Compilation.BuildManager.GetType()这个方法,不管你在不在同一个Assembly中,只要System.Web.Compilation.BuildManager.GetType("类名"),都能得到正确的类类型,它可在顶级程序集或配置中定义的程序集内,自动识别要访问哪个程序集来查找类的类型。

posted @ 2008-07-06 12:47  往事随锋  阅读(803)  评论(1编辑  收藏  举报