请考虑以下代码:
public enum SomeCode
{
NIF = 0
,NIE = 1
,CIF = 2
,PAS = 3
,NIN = 4
,SSN = 5
,OTH = 5
,UKN = 6
}
Run Code Online (Sandbox Code Playgroud)
会改变OTH = 5成OTH = 7一个突破性的变化吗?
编辑:我从不存储int值,只存储枚举的文本表示.它可能在其他DLL中使用,但会使用相同的存储.
Ode*_*ded 12
It is a breaking change, as you are changing a public API.
Libraries/applications that were built with the old value will still hold the old value and use it. You will need to recompile them all.
From MSDN - enum (C# Reference):
与任何常量一样,对枚举的各个值的所有引用在编译时都将转换为数字文字.这可能会产生潜在的版本控制问题,如常量(C#编程指南)中所述.