[flag] public enum lightcolors {unknown = 0, red = 1, yellow = 2, Green = 4, green_arrow = 8}
The current state of light can be set as:
light color c = LightColors.red | LightColors.green_arrow;
and inquire as:
if ((& amp; lightcollers.rd) == lightcolors.rd) {// do not drive} If ((& LightColors.green_arrow) == Light Colors. Green_arrow) {// Turn}
Static class color member able to support this multiple state without additional functionality Will be
However, members of the stable class are generally excellent for the objects used. System.Drawing.Color
Members are great examples because they represent a known-name color Who are obscure creators (unless you know your hex colors). If they were implemented as energy, then every time you want to use the value in the form of color, then something like this must be done:
colors c = colors.red ; Switch (C) {Case color.red: Return System. Drawing Collar FORARBB (255, 0, 0); break; Hair colorful Green: Return System. Drawing Collar From ARGB (0, 255,0); break; }
So if you have got an enumen and discover that your constant one switch / case / if / other / whatever object you want to get, Would like to use. If you are just asking for some situation, then I will be with you. In addition, if you have to pass data to insecure fashion anomes, then probably will be better than a serialized version of your object.
Edit: @stakx, I think that stumbling upon you is also important in responding to Anton Anton's post, and this is complexity or more important, which Is that complicated for it?
From the consumer's perspective, I like the system very much. Drawing After being a member of the stable class, writing all of this from a producer's point of view, however, it would be painful to write all that. So if other people are going to use your code, you can save them a lot by using members of the stable class, even if they can take you 10 times for writing / testing / debugging. However, if it's just easier for you to use emium and cast / need to be done as needed.
Comments
Post a Comment