I have three enums inside my class
public enum CPUBrandEnum {
Intel = 1,
AMD = 2
}
and
public enum CPUTypeIntel {
Celeron,
Pentium4
}
public enum CPUTypeAMD {
ASeries,
ESeries
}
so I have property which hold cpu brand
public CPUBrandEnum CPUBrand { get; set; }
public SelectedCPUType ???
but since I don't know which cpu type will be choosed by the user in runtime I don't know how to construct propertytype which will hold choosen cpu.
If those are object I would derive them from some interface ICPUType but in this case (enum) I'm stuck.
Update: Let me explain usage of this property SelectedType.
User will select cpu brand type from CPUBrandEnum, based on that value I will display either CPUTypeIntel of CPUTypeAMD.
So based on that value SelectedCPUType can be one choosed value from CPUTypeXXX enum.
No, enums can't implement interfaces in .NET. They're really just named numbers.
Even if they could implement interfaces, you'd end up with the potential for bad data (e.g. an "Intel ASeries".
It's not clear what you want to do with these values anyway, but it's possible that you should just have one enum with all the valid possibilities. That might not work for your real situation, of course.
See more on this question at Stackoverflow