Consider the following method,
public void Add(Enum key, object value);
Since Enum is a "special class", I didn't realize you could use the type in this way, but it compiles. Now, the .NET Framework Design Guidelines don't have anything to say about this construction, so I'm curious what everyone else thinks about this.
Here is what this method is doing internally:
public void Add(Enum key, object value)
{
this.dict.Add(key.ToString(), value)
}
Did you expect the parameter to be converted to a string or cast to an int?
Consider the following use-case,
public enum Names
{
John,
Joe,
Jill,
}
Add(Names.John, 10);
Add(Names.Joe, 11);
Is using enum in this way an acceptable alternative to using string constants (given that the domain is the set of all strings which are also valid enum identifiers)?
Last question: Does anyone know of any other real world scenarios that required passing the abstract Enum base class as parameter?