.NET中的全局资源文件 [英] global resource file in .NET

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

问题描述



我正在项目中使用全局资源.

当我将其提取到使用数据表时,它没有按存储在文件中的顺序排序.

有什么解决方案可以按照我保存的顺序从资源表中获取数据吗?

这是我的代码.

Hi,

I am using global resource in my project.

When I fetch it into using data table, it is not ordered as I stored in the file.

Is there any solution to get the data from resource table in the order I saved?

This is my code.

ResourceFileName = "Resources." + ResourceFileName;                   
DataTable dtOperation;
dtOperation = new DataTable();
            
System.Resources.ResourceManager RM = new System.Resources.ResourceManager(ResourceFileName, System.Reflection.Assembly.Load("App_GlobalResources")); //("Resources.vacation", System.Reflection.Assembly.Load("App_GlobalResources"));
ResourceSet resourceSet = RM.GetResourceSet(CultureInfo.CurrentUICulture, true, true);
          dtOperation.Columns.Add("resValue");
          dtOperation.Columns.Add("resKey");
          foreach (DictionaryEntry entry in resourceSet)
           {                    
                DataRow dr = dtOperation.NewRow();
                dr[0] = (String)entry.Value;
                dr[1] =(String)entry.Key;
                dtOperation.Rows.Add(dr);                   
           }    
return dtOperation;

推荐答案

MSDN页面 [ ^ ]

尽管为什么要加载它的顺序无关紧要,这超出了我的范围.
加载后,只需重新排序表格即可.
MSDN Page[^]

Although why it should matter what order it is loaded is beyond me.
Once loaded, simply reorder the table.


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

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