作者热门文章
- c - 在位数组中找到第一个零
- linux - Unix 显示有关匹配两种模式之一的文件的信息
- 正则表达式替换多个文件
- linux - 隐藏来自 xtrace 的命令
考虑以下代码:
public enum SomeCode
{
NIF = 0
,NIE = 1
,CIF = 2
,PAS = 3
,NIN = 4
,SSN = 5
,OTH = 5
,UKN = 6
}
将 OTH = 5
更改为 OTH = 7
会是一个重大更改吗?
编辑:我从不存储 int 值,只存储枚举的文本表示形式。它可以在其他 DLL 中使用,但会使用相同的存储空间。
最佳答案
这是一个重大变化,因为您正在更改公共(public) API。
使用旧值构建的库/应用程序仍将保留并使用旧值。您将需要重新编译它们。
来自 MSDN - enum (C# Reference) :
Just as with any constant, all references to the individual values of an enum are converted to numeric literals at compile time. This can create potential versioning issues as described in Constants (C# Programming Guide).
关于c# - 改变枚举的数量是一个重大变化吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3422178/
不久前,我不小心将一个项目文件转换为 Visual Studio 2010(当然,没有源代码控制)。虽然没有重新创建项目文件(这将只需要大约 10 或 15 分钟),而是查看了典型的 2008 项目文
我是一名优秀的程序员,十分优秀!