我正在尝试创建几个enums
因此,这给出了语法Dropdown.Category.Subcategory
。然而,我一直在读到这不是一个好主意。我的选择主要是因为我想不出任何其他方法来选择不同的enum
值取决于类别的选择,然后子类别的选择取决于所选的enum
基于enum
价值观。
有没有更好的方法来创建这样的功能?我希望能够轻松识别.Category
and .Subcategory
名称,如果这段代码可读的话那就太好了。
只是为了说清楚,我希望能够选择Category
,然后有一个合适的Subcategory
选择。
public class Dropdown
{
public enum Gifts
{
GreetingCards,
VideoGreetings,
UnusualGifts,
ArtsAndCrafts,
HandmadeJewelry,
GiftsforGeeks,
PostcardsFrom,
RecycledCrafts,
Other
}
public enum GraphicsAndDesign
{
CartoonsAndCaricatures,
LogoDesign,
Illustration,
EbookCoversAndPackages,
WebDesignAndUI,
PhotographyAndPhotoshopping,
PresentationDesign,
FlyersAndBrochures,
BusinessCards,
BannersAndHeaders,
Architecture,
LandingPages,
Other
}
}