Message
General information
Fórum:
ASP.NET
Category:
Coding, syntax and commands
Miscellaneous
ID da thread:
01453992
ID da mensagem:
01454196
Views:
28
>>>>>I defined an enum in my App class:
>>>>>
>>>>>
>>>>>public enum Panels
>>>>>{
>>>>>    Login,
>>>>>    Welcome,
>>>>>    ProjectInfo,
>>>>>    Query
>>>>>}
>>>>>
>>>>>
>>>>>Then, in the base panel class I have:
>>>>>
>>>>>
>>>>>private csCOSApp.Panels _PanelType;
>>>>>public csCOSApp.Panels PanelType
>>>>>{
>>>>>    get { return _PanelType; }
>>>>>    set { _PanelType = value; }
>>>>>}
>>>>>
>>>>>
>>>>>I get
>>>>>
>>>>>
>>>>>Inconsistent accessibility: property type '...csCOSApp.Panels' is less accessible than property '....pnlBase.PanelType'
>>>>>
>>>>>
>>>>>Why is this? Why can't I do this?
>>>>
>>>>Because your csCOSApp class is not public ?
>>>
>>>I gotta quit drinking while I'm coding!!!
>>>
>>>Thanks!
>>
>>:-}
>>Actually there's probably no benefit in nesting the enum in this case? As a rule of thumb if the type needs to be directly accessed from outside the nesting class it probably shouldn't be there.....
>
>I put it there because I need to access it througout the app. I'm open to a better degisn tho...

If your csCOSApp class is accessible throughout the app then why not put the enum in the same assembly but not nested:
public class csCosApp
{
}
public enum Panels
{
}
Or, my preference, put types that need to be globally available in a separate assembly altogether. Makes it much easier to avoid the potential problem of assemblies needing to reference each other....
Previous
Next
Responder
Mapa
View