Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个 ASP.NET MVC3 应用程序,我在其中创建多个区域,有没有一种方法可以以编程方式找出存在的区域数量及其名称。我想做的是在不同的区域创建一些部分页面,并在主应用程序中创建一个将呈现部分页面的页面。
有没有办法以编程方式找出存在的区域数量及其名称
没有 AFAIK 目前没有一种简单可靠的方法来做到这一点。在 ASP.NET MVC 4.0 中虽然会有,但我保证 :-)
目前,您可能需要使用反射并查看所有包含它们的名称空间Areas.something并对其进行计数。不是很可靠。
Areas.something