Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Where to put Enumerations
Message
 
To
06/03/2006 16:26:50
General information
Forum:
ASP.NET
Category:
Class design
Miscellaneous
Thread ID:
01101840
Message ID:
01101870
Views:
18
Bonnie,

Somehow I knew you'd answer this and answer it that way. ;) I decided to put it in the class because it's only useful when working with the class itself. Meaning, it will be used in code outside of the class, but only code referencing the class. One of the class properties is of the enumation type.

Thanks,
Chad

>Chad,
>
>This is always my favorite answer .... it depends! <g>
>
>Seriously, though, I think it does depend. If the enum is only used in that class, then I'd put it in the class. If it's something that will be used elsewhere, then put it outside the class.
>
>There are always "exceptions to the rule" ... I have a few projects in my app where I have a separate enumerations.cs file containing all the enums for a particular namespace. If I had a class in one of those namespaces and it needed an enum that would only be used in that class, in this particular case I'd probably put it in the enumerations.cs file instead of within the class itself ... simply for the consistency of having all the enums in one file.
>
>
>~~Bonnie
>
>
>
>
>>Hi all,
>>
>>Is it better to put an enumeration within the class definition or outside of the class, but within the namespace? And why?
>>
>>TIA,
>>Chad
_________________________________
There are 2 types of people in the world:
    Those who need closure
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform