从资源文件读取 [英] Reading from resource file

查看:87
本文介绍了从资源文件读取的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



在我的项目中,有一个要求将资源文件保存在子文件夹中,即myresource.resx文件应保存在"App_GlobalResources/myfolder/myresource.resx"中.我不想将我的资源文件直接保存在"App_GlobalResources"文件夹下.现在,当我从资源文件中读取键/值时,它返回null.但是,当我直接在"App_GlobalResources"文件夹下放置一个新的资源文件(例如test.resx)时,便能够从"App_GlobalResources/myfolder/myresource.resx"中读取值.我正在使用以下代码读取键/值.

Hi,

In my project there is a requirement to keep resource files in to the sub folders i.e. myresource.resx file should be kept in "App_GlobalResources/myfolder/myresource.resx". I do not want to keep my resource file directly under the "App_GlobalResources" folder. Now when I am reading the key/value from the resource file it is returning null. But when I am putting a new resource file (say test.resx) directly under the "App_GlobalResources" folder then I am able to read the values from "App_GlobalResources/myfolder/myresource.resx". I am using following code to read the key/ value.

HttpContext.GetGlobalResourceObject("MyResource", "address");


请让我知道如何在不将任何资源文件直接保存在"App_GlobalResources"文件夹下的情况下,从myresource文件读取值.

在此先感谢,
Alok Kumar


Please let me know how can I read the values from myresource file without keeping any resource file directly under the "App_GlobalResources" folder.

Thanks in Advance,
Alok Kumar

推荐答案

您可以创建本地资源文件,然后可以从aspx页面或
读取它们
You can create local resource file then you can read them from aspx page or
HttpContext.GetLocalResourceObject("MyResource", "address");


但我不明白Global为什么要更改的问题


but i dont understand what is the problem in Global why you want to change


这篇关于从资源文件读取的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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