C#将Culture分为的Neutral Culture 和 Specific Culture,
微软推荐使用 SpecificCulture(其实还有一类Invariant Culture微软不推荐使用,仅仅是周期较短的演示系统开发时推荐使用)
当我们看到 en-US,es-ES等表示culture的名称时,可以这样进行识别
横线前面的部分称为Neutral Culture,它是“与某种语言关联但不与国家/地区关联的区域性”的含义
横线后面的部分称为Specific Culture ,它就是和某个地区国家有关的了
通常采用这种写法,因此我们能很容易分辨这两种Culture,如:fr-FR
只有一种特殊情况,就是中文,它的关系是这样的
zh-CHS Chinese (Simplified) , Neutral
zh-CN Chinese - China
zh-CHT Chinese (Traditional) , Neutral
zh-TW Chinese - Taiwan
zh-HK Chinese - Hong Kong SAR
zh-MO Chinese - Macao SAR
zh-SG Chinese - Singapore
可以看到,主要就是 Neutral通常应该是两位的,但这里的Neutral:zh-CHS和zh-CHT有6位,这是比较容易混淆的,而真正的Specific Culture是:zh-CN,zh-TW ,zh-HK,zh-MO,zh-SG 。
指出这个特例也是本文的目的。
如何使用程序集的密钥?   
·您是指如何将程序集签名吗?   
A:您可以使用   sn.exe   生成一个密钥文件,然后在项目属性里指定要使用的密钥文件。   
·您是指如何通过一个已经签名的程序集的   PublicKeyToken   来导出密钥文件?   
A:这个不大可能吧?   
·如何取得   PublicKeyToken?   
可以参加示例代码:   
using   System;   
using   System.Reflection;   
using   System.Threading;   
using   System.IO;   
using   System.Globalization;   
using   System.Reflection.Emit;   
using   System.Configuration.Assemblies;   
using   System.Text;   
public   class   AssemblyName_CodeBase   
{   
public   static   void   MakeAssembly(AssemblyName   myAssemblyName,   string   fileName)   
{   
//   Get   the   assembly   builder   from   the   application   domain   associated   with   the   current   thread.   
AssemblyBuilder   myAssemblyBuilder   =   Thread.GetDomain().DefineDynamicAssembly(myAssemblyName,   AssemblyBuilderAccess.RunAndSave);   
//   Create   a   dynamic   module   in   the   assembly.   
ModuleBuilder   myModuleBuilder   =   myAssemblyBuilder.DefineDynamicModule("MyModule",   fileName);   
//   Create   a   type   in   the   module.   
TypeBuilder   myTypeBuilder   =   myModuleBuilder.DefineType("MyType");   
//   Create   a   method   called   'Main'.   
MethodBuilder   myMethodBuilder   =   myTypeBuilder.DefineMethod("Main",   MethodAttributes.Public   |   MethodAttributes.HideBySig   |   
MethodAttributes.Static,   typeof(void),   null);   
//   Get   the   Intermediate   Language   generator   for   the   method.   
ILGenerator   myILGenerator   =   myMethodBuilder.GetILGenerator();   
//   Use   the   utility   method   to   generate   the   IL   instructions   that   print   a   string   to   the   console.   
myILGenerator.EmitWriteLine("Hello   World!");   
//   Generate   the   'ret'   IL   instruction.   
myILGenerator.Emit(OpCodes.Ret);   
//   End   the   creation   of   the   type.   
myTypeBuilder.CreateType();   
//   Set   the   method   with   name   'Main'   as   the   entry   point   in   the   assembly.   
myAssemblyBuilder.SetEntryPoint(myMethodBuilder);   
myAssemblyBuilder.Save(fileName);   
}   
public   static   void   Main()   
{   
//   Create   a   dynamic   assembly   with   name   'MyAssembly'   and   build   version   '1.0.0.2001'.   
AssemblyName   myAssemblyName   =   new   AssemblyName();   
//   Set   the   codebase   to   the   physical   directory   were   the   assembly   resides.   
myAssemblyName.CodeBase   =   String.Concat("file:///",   Directory.GetCurrentDirectory());   
//   Set   the   culture   information   of   the   assembly   to   'English-American'.   
myAssemblyName.CultureInfo   =   new   CultureInfo("en-US");   
//   Set   the   hash   algoritm   to   'SHA1'.   
myAssemblyName.HashAlgorithm   =   AssemblyHashAlgorithm.SHA1;   
myAssemblyName.VersionCompatibility   =   AssemblyVersionCompatibility.SameProcess;   
myAssemblyName.Flags   =   AssemblyNameFlags.PublicKey;   
//   Provide   this   assembly   with   a   strong   name.   
myAssemblyName.KeyPair   =   new   StrongNameKeyPair(File.Open("KeyPair.snk",   FileMode.Open,   FileAccess.Read));   
myAssemblyName.Name   =   "MyAssembly";   
myAssemblyName.Version   =   new   Version("1.0.0.2001");   
MakeAssembly(myAssemblyName,   "MyAssembly.exe");   
//   Get   the   assemblies   loaded   in   the   current   application   domain.   
Assembly[]   myAssemblies   =   Thread.GetDomain().GetAssemblies();   
//   Get   the   dynamic   assembly   named   'MyAssembly'.     
Assembly   myAssembly   =   null;   
for(int   i   =   0;   i   <   myAssemblies.Length;   i++)   
if(String.Compare(myAssemblies[i].GetName().Name,   "MyAssembly")   ==   0)   
myAssembly   =   myAssemblies[i];   
//   Display   the   full   assembly   information   to   the   console.   
if(myAssembly   !=   null)   
{   
Console.WriteLine("\nDisplaying   the   full   assembly   name.\n");   
Console.WriteLine(myAssembly.GetName().FullName);   
Console.WriteLine("\nDisplaying   the   public   key.\n");   
byte   []pk;   
pk   =   myAssembly.GetName().GetPublicKey();   
for   (int   i=0;i<pk.GetLength(0);i++)   
Console.Write   ("{0:x}",   pk[i]);   
Console.WriteLine();   
Console.WriteLine("\nDisplaying   the   public   key   token.\n");   
byte   []pt;   
pt   =   myAssembly.GetName().GetPublicKeyToken();   //   此行取得   PublicKeyToken   
for   (int   i=0;i<pt.GetLength(0);i++)   
Console.Write   ("{0:x}",   pt[i]);   
}   
}   

程序集引用里面的“Culture=neutral”是什么意思?相关推荐

  1. 未能加载文件或程序集“Oracle.DataAccess, Version=2.112.1.0, Culture=neutral, PublicKeyToken=89b483f429c47342...

    若本机的Oracle版本是64位系统,则在调用Oracle数据的时间报以下错误: [未能加载文件或程序集"Oracle.DataAccess, Version=2.112.1.0, Cult ...

  2. 未能加载文件或程序集“System.Runtime.Serialization, Version=2.0.5.0, Culture=neutral,

    在用arcgis server for silverlight api 开发过程中,出现了这么个错误 "未能加载文件或程序集"System.Runtime.Serializatio ...

  3. (8)C#导入库编译出错:请考虑使用 app.config 将程序集“log4net, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a”

    当引用SuperSocket类库时,导致编译出下面的提示: 请考虑使用 app.config 将程序集"log4net, Culture=neutral, PublicKeyToken=66 ...

  4. VS错误:未能加载文件或程序集“NPOI, Version=2.3.0.0, Culture=neutral, PublicKeyToken...

    未能加载文件或程序集"NPOI, Version=2.3.0.0, Culture=neutral, PublicKeyToken=b03f5-它的某一个依赖项.找到的程序集清单定义与程序集 ...

  5. 未能加载文件或程序集“Newtonsoft.Json,Version = 13.0.0.0,Culture = neutral,PublicKeyToken = 30ad4fe6b2a6aeed“..

    未能加载文件或程序集"Newtonsoft.Json,Version = 13.0.0.0,Culture = neutral,PublicKeyToken = 30ad4fe6b2a6ae ...

  6. 未能加载文件或程序集“Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=

    未能加载文件或程序集"Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed& ...

  7. 未能加载 mysql.data_连接MySQL 提示错误”未能加载文件或程序集“MySql.Data, Version=5.1.4.0, Culture=neutral,……..” | 学步园...

    CodeSmith4.1.3版本连接MySQL 提示错误"未能加载文件或程序集"MySql.Data, Version=5.1.4.0, Culture=neutral,..... ...

  8. 未能加载文件或程序集“System.Data.SQLite, Version=1.0.96.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139...

    不少朋友在使用C#连接SQLite后会出现错误:其他信息: 未能加载文件或程序集"System.Data.SQLite, Version=1.0.96.0, Culture=neutral, ...

  9. 未能加载文件或程序集 System Drawing Version 4 0 0 0 Culture neutral

    分享一下我老师大神的人工智能教程!零基础,通俗易懂!http://blog.csdn.net/jiangjunshow 也欢迎大家转载本篇文章.分享知识,造福人民,实现我们中华民族伟大复兴! 完整错误 ...

  10. 未能加载文件或程序集“office, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c”或它的某一个依赖项。拒绝访问

    未能加载文件或程序集"office, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c"或它的某 ...

最新文章

  1. Linux-HA 高可用开源方案 Keepalived VS Heartbeat 对比
  2. 智能计米器jk76怎么安装_智能电视怎么安装软件?详细教程一学就会
  3. 直播预告丨数十家平台实战真经,解密 IPTV 数据破局之道
  4. 成都信息工程大学c语言题库,成都信息工程学院C语言考试题及答案.docx
  5. 产品需求文档、需求结构图、数据字典、全局说明、用例描述、需求描述、逻辑流程、原型设计、页面交互、登录注册、词汇表、数据统计、用户表设计、接口需求、功能清单、业务流程图、Axure原型、prd、文档实例
  6. Attach and Detach in VC
  7. RabbitMQ 中的 7 种队列模式,写得太好了!
  8. 互亿无线短信接口开发
  9. 15串行加法器和并行加法器原理
  10. 00002__失恋卖茶女
  11. 百度指数 爬虫 更新版
  12. 【word】设置背景为绿豆沙保护色
  13. 在Ubuntu18.04上编译SWASH模型
  14. 软件测试——三角形问题测试用例练习
  15. 收藏 | 42 款 Chrome 插件神器,你必须知道!
  16. NLP入门之综述阅读-自然语言处理发展及应用综述
  17. 为将来而记下的过去——扭曲的爱,病态的教育
  18. 怎样与团队成员沟通,从而提高团队的执行力?
  19. 四针角oled屏连接arduino_ESP8266连接OLED显示屏并显示位图图像
  20. ftp文件盘服务器回档,企业网盘和FTP服务器对比

热门文章

  1. HTTP请求解析错误的进一步发生将记录在DEBUG级别
  2. POJ 3080 Blue Jeans(KMP + 暴力)
  3. 用python画一个机器猫歌词_用Python语言模型和LSTM做一个Drake饶舌歌词生成器!自己蒙了!...
  4. 自然语言处理Pytorch实现CharRNN歌词生成
  5. 课程回顾丨基于FPGA的OFDM可见光通信系统实现
  6. XMLHttpRequest.readyState 状态
  7. 用Matplotlib画两张花里胡哨的图
  8. Python selenium淘宝抢购物品程序
  9. 酵素果冻真的能减肥吗?
  10. SQL Server安装中错误该性能计数器注册表配置单元已损坏。若要继续,必须修复该性能计数器注册表配置单元的解决