According to MSDN here and here (as well as the accepted answer to this qstn ), the default accessibility for enums is public
. However, this code:
public class Test { enum Color { RED, BLUE, GREEN }; public void SetColor(Color c) { } }
will raise this compilation error:
Error 1 Inconsistent accessibility: parameter type 'Test.Color' is less accessible than method 'Test.SetColor(Test.Color)'
(This is the same error that you get when setting an enumeration as private
.) This error can only be resolved by explicitly changing the enumeration as public
. Invalid documentation?
[I am compiling with C # 2010 and .NET 4.0.]
kmote source share