E
Erik Funkenbusch
I've been thinking about different ways to address this problem, and I
figured i'd just toss this out and see if anyone has a good solution.
I've got database field of type char(1), this field can contain a number of
different values {O, P, B, L, C, 1, 2, 3, 4, 5, 6, 7 , 8, 9}
Now, I want to translate this to some form of typed variable in my data
abstraction layer.
My initial thought was to use an enum, with the proper names of each of
those types {Open = 'O', Postponed = 'P', etc..} but I discovered that you
can't base an enum on type char.
My next thought was to simply use a standard enum, and do some nasty big
switch statement logic (or array indexing, or a dictionary lookup of some
sort), but I don't like this if I don't have to. Further, I may have need
to get at the "real" value behind the enum from time to time.
Maybe I should just break down and create a data class that can accept both
enumeration values and "real" values?
What i'm really looking for is some kind of "set" logic. Any thoughs on
how to approach this?
figured i'd just toss this out and see if anyone has a good solution.
I've got database field of type char(1), this field can contain a number of
different values {O, P, B, L, C, 1, 2, 3, 4, 5, 6, 7 , 8, 9}
Now, I want to translate this to some form of typed variable in my data
abstraction layer.
My initial thought was to use an enum, with the proper names of each of
those types {Open = 'O', Postponed = 'P', etc..} but I discovered that you
can't base an enum on type char.
My next thought was to simply use a standard enum, and do some nasty big
switch statement logic (or array indexing, or a dictionary lookup of some
sort), but I don't like this if I don't have to. Further, I may have need
to get at the "real" value behind the enum from time to time.
Maybe I should just break down and create a data class that can accept both
enumeration values and "real" values?
What i'm really looking for is some kind of "set" logic. Any thoughs on
how to approach this?