'Enum as Dictionary keys

Suppose to have

enum SomeEnum { One, Two, Three };

SomeEnum is an enum so it is supposed to inherit from Enum so why if I write:

Dictionary<Enum, SomeClass> aDictionary = new Dictionary<SomeEnum, SomeClass>();

The compiler complains that it cannot implicitly convert SomeEnum to Enum?



Solution 1:[1]

Enum in its declaration is not a class that is equal to SomeEnum. It should be

Dictionary<SomeEnum, SomeClass> aDictionary = new Dictionary<SomeEnum, SomeClass>();

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Krishna Sarma