c# - NHibernate 引用的 C# 标识符中的非 ASCII 字符

标签 c# nhibernate enums

我尝试在 C# 标识符中输入非 ASCII 字符,程序编译和运行都很好(至少乍一看是这样)。更准确地说,我在枚举中使用克罗地亚语变音字符 (čćđšž)。我确实需要使用这些特殊字符,因为我将字符串枚举映射为 NHibernate 中的值对象。在向用户显示查询时必须避免使用这些标准字符,这真的很丑陋。在我开始以这种方式大规模使用枚举之前,我真的需要知道这种编程技术(尤其是关于 NHibernate)是否有任何影响(隐藏的陷阱)?或者,如果您有更好的处理方法,请告诉我。

还有,重构、SVN等工具有没有问题

最佳答案

C#语言使用unicode编码,这意味着你的特殊字符不会有问题。但是,我喜欢使用没有特殊字符的英文代码。我还没有找到可以证明使用特定于文化的命名的问题。

来自 C# 语言规范:

A C# program consists of one or more source files, known formally as compilation units (§9.1). A source file is an ordered sequence of Unicode characters. Source files typically have a one-to-one correspondence with files in a file system, but this correspondence is not required. For maximal portability, it is recommended that files in a file system be encoded with the UTF-8 encoding.

第 2.1 节(Microsoft C# Language Specification)

关于c# - NHibernate 引用的 C# 标识符中的非 ASCII 字符,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5410643/

相关文章:

c# - 如何将自定义复杂类型转换为另一个自定义复杂类型

nhibernate - NHibernate 3.3 中的映射继承

c# - NHibernate SchemaExport 不创建 ntext 列

nhibernate - 是否有一个 NHibernate 标准实际上什么都不做?

c# - Linq 包含枚举数组

c - 是否可以从汇编文件中引用 C 枚举?

c# - AJAX 不将复选框值传输到 Controller

c# - 带有模式的 Switch 语句

c - 出现错误[Pe020] : identifier "" is undefined in IAR with an typedef enum

c# - 我可以从 WindowsPrincipal 获取 Active Directory 属性吗?