We have some stuff that may be exported into various formats. Currently we have these formats represented by an enum like this:
[Flags]
public enum ExportFormat
{
None = 0x0,
Csv = 0x1,
Tsv = 0x2,
Excel = 0x4,
All = Excel | Csv | Tsv
}
Problem is that these must be enumerated and they also need a translation or des...
I have an enum in Java for the cardinal & intermediate directions:
public enum Direction {
NORTH,
NORTHEAST,
EAST,
SOUTHEAST,
SOUTH,
SOUTHWEST,
WEST,
NORTHWEST
}
How can I write a for loop that iterates through each of these enum values?
...
hi, all. I need to use java 5 enum in velocity template, so that I could write something like
public enum Level{
INFO, ERROR;
}
Velocity template:
#if($var == Level.INFO)
...
#else
...
#end
How can it be done? Thanks in advance.
...
Hi All,
Imagine I have an enumeration such as this (just as an example):
public enum Direction{
Horizontal = 0,
Vertical = 1,
Diagonal = 2
}
How can I write a routine to get these values into a System.Web.Mvc.SelectList, given that the contents of the enumeration are subject to change in future? I want to get each enumera...
Is the sizeof(enum) == sizeof(int), always ?
Or is it compiler dependent?
Is it wrong to say, as complier are optimized for word lengths (memory alignment) ie y int is the word-size on a particular complier.Does it means that there is no processing penalty if i use enums, as they would be word aligned.
Is it not better if i put all th...
I have to transfer some values to be used as commands over the network, and I wish to make it as efficient and robust as possible, i.e. I need opinions on what to use for these commands, #defines or enums?
The range of commands shall not be more than 20 commands(lets say 40 with every defined response to the command), so according to mo...
Thing is, I don't see these ENUMs producing pull-down menus in CakePHP scaffolding, so I'm thinking CakePHP might advise against it, but I can't find any documentation on the matter.
Anyone know whether or not to use ENUMs?
...
Is there any way to put spaces in a C# enum constant? I've read that you can do it in VB by doing this:
Public Enum EnumWithSpaces
ConstantWithoutSpaces
[Constant With Spaces]
End Enum
...and then access it like this:
Public Sub UsingEnumWithSpaces()
Dim foo As EnumWithSpaces = EnumWithSpaces.[Constant With Spaces]
End Sub
...
I'm trying to understand how to use Type Converters after reading this answer to one of my other questions. But I'm not sure if I quite get it...
In my particular case I would like to "convert" an enum member into a localized string by getting a resource string depending on what enum member it is. So for example if I had this enum:
pub...
I'm using C# in VS2005. I have a class library that contains several enums common to a number of different projects. When accessing one of these enums I have to specify the whole namespace path to the enum even though I have declared a 'using' directive to the namespace that contains the enum.
For example I have the following enum:
nam...
For example, I have two elements in an enum. I would like the first to be represented by the integer value 0 and the string A, but the second to be represented by the integer value of 2 and the string "B" (as opposed to 1). Is this possible?
Currently, my enum is declared as this:
public enum Constants {
ZERO("Zero");
TWO("Two"...
This may have been answered elsewhere but I could not find a suitable response.
I have this code:
enum enumWizardPage
{
WP_NONE = 0x00,
WP_CMDID = 0x01,
WP_LEAGUES = 0x02,
WP_TEAMS = 0x04,
WP_COMP = 0x08,
WP_DIVISIONS = 0x10,
WP_FORMULAS = 0x20,
WP_FINISHED = 0x40,
};
Which is legacy and I have...
So, say I have a simple enum and a class that uses it:
enum ThingType { POTATO, BICYCLE };
class Thing {
public void setValueType(ThingType value) { ... }
public ThingType getValueType() { ... }
}
But, in reality, I have lots of different classes that implement setValueType, each with a different kind of enum. I want to make ...
im trying to pass back from a user control a list of strings that are part of an enum, like this:
<bni:products id="bnProducts" runat="server" ProductsList="First, Second, Third" />
and in the code behid do something like this:
public enum MS
{
First = 1,
Second,
Third
};
private MS[] _ProductList;
pu...
enum bool{true,false};
void main()
{
if(true==(2==3))
{
printf("true\n");
}
else
{
printf("false\n");
}
return 0;
}
...
I built a simple vb.net winforms project that pings IP addresses and logs the results. It works fine on most machines I've tried it on. I log the status result of the ping (System.Net.NetworkInformation.IPStatus) by using the IPStatus.tostring method.
Normally this returns a text result such as "Success" or "TimedOut"
Yesterday, on one...
I'm trying to bind a XAML ComboBox so that its list items are the members of the System.IO.Ports.Parity enum.
I've found plenty of examples of databinding enums, but it seems these don't work if the enum is in a different namespace (like System.IO.Ports).
Right now I have:
<ObjectDataProvider MethodName="GetValues" ObjectType="{x:Ty...
i have a class and have declared an enum in it like
public enum file_type {readonly, readwrite, system}
Now based on a condition i want to set the enum file_type to a value something like
if("file is markedreadonly")
file_type = readonly;
is it possible to do so in c#
...
This is a bug?
Using NHibernate.Expression.Example.Create(userExample) if my class use Int32 on property 'Type' all works fine.
public class User:Person
{
public virtual String NickName { get; set; }
public virtual String Password { get; set; }
public virtual Int32 Type { get; set; }
public enum UserType
{
...
Are there (performance) penalties* associated with the Enum Singleton Pattern in any way, as it seems to be used less than the classical singleton pattern or the inner holder class idiom?
* Penalties, such as the cost of serializability in cases when it is not needed and such, or is the usage low because few of the developers read Effe...