J
Just Me
I keep hitting the same minor problem, but dont have a really great
solution. So Im looking for ideas.
There are many instances where I want to force the developer ( me ) from a
readability and robustability point of view to choose from a list of
predefined choices when calling functions. Well, of course enums are good
for this, so I could have something like this. In which a webfrom textboxm
gets a css class attribute which equals the name of the enum member.
public enum messageType {fail=0,pass=1,warning=3}
public void message( string msgStr, messageType msgType )
{
myTextBox.Attributes.add("class",msgType.toString());
myTextBox.Text=msgStr;
}
// However. I would like to abstract the name used by the developer and the
actuall css class applied. Any suggestions on how to do this.
I thought instead of using an enum, I could use constant members but how
could I force the developer to enter the classtype with the constants in ?
Im sure someone has a groovy easy answer !
solution. So Im looking for ideas.
There are many instances where I want to force the developer ( me ) from a
readability and robustability point of view to choose from a list of
predefined choices when calling functions. Well, of course enums are good
for this, so I could have something like this. In which a webfrom textboxm
gets a css class attribute which equals the name of the enum member.
public enum messageType {fail=0,pass=1,warning=3}
public void message( string msgStr, messageType msgType )
{
myTextBox.Attributes.add("class",msgType.toString());
myTextBox.Text=msgStr;
}
// However. I would like to abstract the name used by the developer and the
actuall css class applied. Any suggestions on how to do this.
I thought instead of using an enum, I could use constant members but how
could I force the developer to enter the classtype with the constants in ?
Im sure someone has a groovy easy answer !