JohnAskew wrote:
Unfortunately, the ClassA happens to be a native class of .NET framework so I have little control on that, the best I could hope for is to create a type that is compatible of ClassA.Status so I can directly assign the value of it to a variable of ClassB.StatusEx type.
ScanIAm wrote:
If you wanted, you could create a separate,
static class to hold the statuses. Then, when you started up, each
class would feed it's own statuses into the static class where they'd
be stored in a hashtable.
If you need to do this
programmatically, I can't figure out how the base class could
understand a status it's never seen.
No, I won't use StatusEx in any of the methods provided by ClassA.
I just want to way to directly assign the value to the new variable type, instead of using "switch" statement to map it one by one.
(In the analogy of that, assume ClassA.Status to be byte and ClassB.StatusEx to be integer. I wouldn't assign an integer to byte as overflow may occur. And it'd be quite insane to have huge "switch table" to map "1" to "1", then "2" to "2", etc. when doing conversion, right?)