在工程里有一个ResourceFile文件夹,里面有两个资源文件SYM00005.zh-CHS.resx,SYM00005.zh-CHT.resx.请问如何根据不同的语言访问对应资源文件的内容.谢谢.

解决方案 »

  1.   

    string cultureName = "zh-CHT";
    CultureInfo ci = new CultureInfo(cultureName);
    string resourceName = "aaa"; //表示资源文件中的Name
    string value = HttpContext.GetGlobalResourceObject("SYM00005",resourceName, ci) as string; //value为资源文件中name为aaa对应的值
      

  2.   

    楼上我做的是windows form程序.
      

  3.   

    ResourceManager my=new ResourceManager("app_one.zhu12",System.Reflection.Assembly.GetExecutingAssembly());
    Icon my1=(Icon)my.GetObject("r1");
    Image my3=(Image)my.GetObject("r3");
    MessageBox.Show("ok");
    this.pictureBox1.Image=my3;
      

  4.   

    稍微改改就可以了
    System.Resources.ResourceManager mgr = new System.Resources.ResourceManager("YourProjectName.SYM00005", Assembly.GetExecutingAssembly());
    CultureInfo ci = new CultureInfo("zh-CHT");
    string str = mgr.GetString("Name", ci);