Is it possible to create an enum whose object can't be created but can be used for readonly purpose
- by Shantanu Gupta
I created an enum where I stored some table names. I want it to be used to get the name of the table like ds.Tables[BGuestInfo.TableName.L_GUEST_TYPE.ToString()].
public enum TableName : byte
{
L_GUEST_TYPE = 0
,L_AGE_GROUP = 1
,M_COMPANY = 2
,L_COUNTRY = 3
,L_EYE_COLOR = 4
,L_GENDER = 5
,L_HAIR_COLOR = 6
,L_STATE_PROVINCE = 7
,L_STATUS = 8
,L_TITLE = 9
,M_TOWER = 10
,L_CITY = 11
,L_REGISTER_TYPE = 12
}
This is my enum. Now I have not created any object of this enum so that no one can use it for other than read only purpose.
For this enum to be accessible in outer classes as well I have to make it public which means some outer class can create its object as well.
So what can i do so as to restrict its object creation.