mardi 9 août 2016

Alternative to enum in design pattern

Consider the case of a base assembly base having an enum type like

public enum ItemState = { red, green, blue };

I use this base assembly within other assemblies Project_1, Project_2 and so on.

Each of them does some specific stuff, and requires project-specific states, like {grey, black, white, ...} in Project_1 and {brown, transparent, ...} in Project_2.

Project_1 isn't allowed to use (and if possible even see) {brown, transparent, ...}. Similarly, Project_2 cannot use {grey, black, white, ...}.

I know "partial enum" doesn't exist - so what is the suggested design pattern for such a task?

Aucun commentaire:

Enregistrer un commentaire