You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The usual usage of SmartEnum<TEnum> is like this I believe:
publicclassFoo:SmartEnum<Foo>{}
For some rather esoteric reasons, I'm trying to use it like this:
publicclassFoo{publicclassBar:SmartEnum<Foo>{}}
Note that the class deriving from SmartEnum<TEnum> is different than the type TEnum in SmartEnum<TEnum> (Bar vs. Foo). Is this a supported scenario?
The reason I'm trying to make the second option work is to avoid a naming collision. My class (Foo in the example) has a property with the same name as one of the enumerated options that I want to expose as a static field. Obviously the names collide. One idea to avoid the name collision was to introduce a nested class that defines the enumeration options. In other words, usage would like this:
varsomeValue= Foo.Bar.SomeValue;
...rather than the more usual:
varsomeValue= Foo.SomeValue;
I've found that the SmartEnum<TEnum>.List property doesn't work in this scenario. List is ultimately populated with a call to GetAllOptions(), which is defined like this:
I wonder, would it be possible to change this implementation in a backwards compatible manner such that the "normal" scenario would continue to work as before, while also supporting my "new" scenario?
The text was updated successfully, but these errors were encountered:
The usual usage of
SmartEnum<TEnum>
is like this I believe:For some rather esoteric reasons, I'm trying to use it like this:
Note that the class deriving from
SmartEnum<TEnum>
is different than the typeTEnum
inSmartEnum<TEnum>
(Bar
vs.Foo
). Is this a supported scenario?The reason I'm trying to make the second option work is to avoid a naming collision. My class (
Foo
in the example) has a property with the same name as one of the enumerated options that I want to expose as a static field. Obviously the names collide. One idea to avoid the name collision was to introduce a nested class that defines the enumeration options. In other words, usage would like this:...rather than the more usual:
I've found that the
SmartEnum<TEnum>.List
property doesn't work in this scenario.List
is ultimately populated with a call toGetAllOptions()
, which is defined like this:I wonder, would it be possible to change this implementation in a backwards compatible manner such that the "normal" scenario would continue to work as before, while also supporting my "new" scenario?
The text was updated successfully, but these errors were encountered: