473,473 Members | 2,148 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

assign string to enum member

is there a way to explicitly assign a name to an enum member?
what about internationalisation? one must be able to change the text.

i'd like to implemtent it this way:

enum Color =
{
Red="Rot",
Green="Grün",
Blue="Blau"
};

--
cody

Freeware Tools, Games and Humour
http://www.deutronium.de.vu
[noncommercial and no fucking ads]

Nov 15 '05 #1
2 4362
Cody Manix <de********@web.de> wrote:
is there a way to explicitly assign a name to an enum member?
what about internationalisation? one must be able to change the text.

i'd like to implemtent it this way:

enum Color =
{
Red="Rot",
Green="Grün",
Blue="Blau"
};


Assigning a single name to it doesn't help much in terms of
internationalisation - you basically need to be able to do a resource
lookup from the enum name to the user text.

You can apply the Description attribute to enum members, I believe -
that may help you, depending on your needs.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet/
If replying to the group, please do not mail me too
Nov 15 '05 #2
>> enum Color =
{
Red="Rot",
Green="Grün",
Blue="Blau"
};
You can apply the Description attribute to enum members, I believe -
that may help you, depending on your needs.


i have a combobox where i want to fill the enumeration members in. the
display content of the combobox should vary dependant oo the current
culture.
--
cody

Freeware Tools, Games and Humour
http://www.deutronium.de.vu
[noncommercial and no fucking ads]

Nov 15 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: deko | last post by:
I've heard it said that you only want to use a number (e.g. integer, long, etc.) if you are going to do calculations or some kind of math with it. Is this true? For example, I run a validate...
7
by: archway | last post by:
I know you cannot have string enumerations such as: enum myStringEnum { enumItem1 = "value 1", enumItem2 = "value 2", etc } However, I was wondering whether you had ever created something...
4
by: Popoxinhxan | last post by:
Hi guy, i just wondering that is it posible to convert the array of string to enum types dynamically, for example i get the list of countries name from database and would like to convert all of...
3
by: Sanjay Pais | last post by:
I know that string/char enum is not possible in c# (.NET2.0) I need to create the equivalent of this: public enum HOW_GOOD { AWESOME = "A", GREAT= "G", NOT_TOO_BAD = "N", TERRIBLE="T" }
8
by: kc | last post by:
I'm trying to pull data from a database that I have no control over the structure of. There's a members table with a column for the member's sex. It just stores the sex as M or F. I'd like to...
18
by: **Developer** | last post by:
If e.Button = MouseButtons.Left Then also from a Dim Answer As DialogResult = MessageBox.Show.. Select Case Answer Case DialogResult.Yes
13
by: toton | last post by:
Hi, I have some enum (enumeration ) defined in some namespace, not inside class. How to use the enum constant's in some other namespace without using the whole namespace. To say in little...
9
by: subramanian | last post by:
Hello. Consider the following code fragment : enum TestEnum { val1 = 10, val2 = 100, val3 = 1000 }; class Test { public : enum TestEnum { val1 = 1, val2 val3 }; Test(int i = 0, int j = 0,...
9
by: raylopez99 | last post by:
Just an observation: pens for drawing lines in Win Forms are tricky when assignment is inside the paint handler. inside of the Paint handler, but not inside a "using" brace (that is, outside of...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.