tags:

views:

23

answers:

1

Do I need to make an enum?

I want something like:

MyHardwareReport.Peripheral = ListOfPeripherals.Mouse

or

MyHardwareReport.Peripheral = ListOfPeripherals.Printer

How can I achieve something like this?

A: 

Yes, an enum is exactly what you need. General practice would be to name the enum type after the class, rather than calling it a "ListOfSomething".

public enum Peripheral
{
    Mouse,
    Keyboard,
    Printer
}
tzaman