For example:
public enum Unit{
KW,
kV,
V,
Hz,
%V
}
In this case % is a special character. So, how can I put this char in a enum?
See Question&Answers more detail:osFor example:
public enum Unit{
KW,
kV,
V,
Hz,
%V
}
In this case % is a special character. So, how can I put this char in a enum?
See Question&Answers more detail:osEven if you could do that (and it looks you can't), it probably wouldn't be a good idea, because you'd be mixing how the enum should be displayed with the program code to manipulate it. A better option would be to define an attribute (or use existing DisplayNameAttribute
) and annotate your enum with names as additional meta-data:
public enum Unit{
[DisplayName("Hz")] Hertz,
[DisplayName("%V")] Volt
}