Enum value as hidden in C#

后端 未结 9 894
暖寄归人
暖寄归人 2020-12-21 01:40

I have an enum and i want to \"hide\" one of its values (as i add it for future support). The code is written in C#.

public enum MyEnum
{
   ValueA = 0,

            


        
9条回答
  •  一个人的身影
    2020-12-21 02:35

    one way you can do this set the value of this variable null. so when ever its called from enum it'll b null. in short user can't access its value.

    public enum MyEnum
    {
       ValueA = 0,
       ValueB = 1,
    
       Reserved.None
    }
    

提交回复
热议问题