如何在ASP.NET MVC Controller中读取GlobalResources? [英] How to read GlobalResources in ASP.NET MVC Controller?

查看:109
本文介绍了如何在ASP.NET MVC Controller中读取GlobalResources?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我找不到在控制器中读取资源值的方法

I can't find a way to read resource values in a controller

推荐答案

如果要引用存储在App_GlobalResources中的字符串资源,则可以添加一个

If you're referring to string resources stored in App_GlobalResources then you can add a

using Resources;

并通过

Strings.<name of resource>

或使用

Resources.Strings.<name of resource>

这篇关于如何在ASP.NET MVC Controller中读取GlobalResources?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆