ResourceManager
使用.Designer.csnew ResourceManger(myResourceType.FullName, myResourceType.Assembly)
生成的类MyResourceType.ResourceManager
(
我正在使用 .resx 文件的 ASP.NET MVC 3 应用程序的上下文中工作。
编辑:我对为新对象分配内存的成本之外的影响感兴趣。
编辑:查看 MSDN 文档ResourceManager.ReleaseAllResources
,它指出:
This method will shrink the working set in a running application. Any future resource lookups on this ResourceManager will be as extensive as the first lookup, since it will need to search and load resources again.
这似乎意味着资源集的初始开放是昂贵的,这对我来说意味着在每个请求上创建一个新的管理器可能会很昂贵。但是,文档并未就资源管理器的生命周期/范围提出最佳实践。