5
votes
1answer
56 views

Turn multiple key presses into single GameAction

The InputHandler class for my game detects key presses, turns each one into a GameAction, and raises an event. ...
4
votes
1answer
867 views

Concerned with Enums, JSON, and ASP.NET MVC

I am writing an application that uses ASP.NET MVC for its front end, and for the back end, it uses RavenDB to store data. This ...
3
votes
1answer
102 views

Genericizing PropertyValues

This should be the last iteration for this code. Question 1 Does this approach make sense or am I heading down the wrong path? Question 2 The only thing I can see to make this better is to ...
5
votes
3answers
3k views

Loading a combobox with an enum and binding to it

I have the following code to load an enumeration into a bound combo box, but am not quite happy with it. I would prefer to store the actual enum value in the ...
2
votes
4answers
180 views

Enum or Constant

I'm writing a SDK for a NFC device in .NET so I don't have to import the SDK from C++. Right now I'm working on the ISO14443-3 part which is just simple Halt, Request, and Anticollision commands. The ...
4
votes
2answers
344 views

Alternative to starting enum values with a number?

I have an enum like the following: enum MeasurementBandwidth { Hz1 = 1, Hz3 = 3, Hz10 = 10, ... } But I do not like the ...
3
votes
2answers
109 views

Managing fault types

I have a FaultType enum with more than 100 members: ...
0
votes
3answers
697 views

Converting a c# enum into a list to be sent to the client

I want to use the enum on the client for a dropdown list. Does this make sense, or is there a smarter way of doing this? ...
1
vote
1answer
72 views

Is this enum declaration “wrong,” or is it just me?

Legacy code has this enum declaration: public enum ChangeListTypes { Always = 1, Never = 2, CostChange = 3, None = 0 } I would have done it this ...
38
votes
15answers
2k views

Cleaner way to code BOOL×BOOL→ENUM mapping?

Does this part look clean enough? Any suggestions on how to make it cleaner? ...
4
votes
1answer
242 views

Parse Flags enum from array of booleans

I need to get from an array of booleans to a Flags enum. Here's what my enum looks like: ...
11
votes
2answers
630 views

Advice on naming convention with enum

I have an enum called NodeType. Since my public field does not want to conflict with enum, ...
2
votes
2answers
2k views

How can an Enumeration with Descriptions be cast into a Dictionary?

The Enumeration in question is based on int, so the following Extension returns a Dictionary<int, string> of the Enum's ...
6
votes
3answers
3k views

Enum vs int wrapper struct

I am writing code that has objects having integer member variables where the integer value has a specific constant meaning, which normally means "use an enum". Suppose the values are the days of the ...
10
votes
1answer
11k views

Getting the value of a custom attribute from an enum

Suppose we have an enum called "Planet" and it has a custom attribute of class "PlanetAttr", these methods will give you the attribute value for a given Planet value: ...