473,322 Members | 1,510 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

enumeration help

i have the following

enum length { metres = 0, centimetres, millimetres }

By knowing the integer (0, 1 2 ....) how do i obtain the name (metres,
centimetres....)??

thanks

--
//remove SPAM to reply by email
Nov 16 '05 #1
1 1829
Just cast the integer value to your enum value. example

enum length
{
metres = 0,
centimetres = 1,
millimetres = 2
}

//in the method
public void test()
{
length x = length.centimetres;
int a = (int) x; // a becomes 1;

int b = 0;
length y = (length) b; // y becomes length.metres
}
hth

Fitim Skenderi

"Luke Smith" <lu**********@SPAMbtinternet.com> wrote in message
news:OB**************@TK2MSFTNGP11.phx.gbl...
i have the following

enum length { metres = 0, centimetres, millimetres }

By knowing the integer (0, 1 2 ....) how do i obtain the name (metres,
centimetres....)??

thanks

--
//remove SPAM to reply by email

Nov 16 '05 #2

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

Similar topics

1
by: Justin Wright | last post by:
I know that I can set up an enumeration as follows ( just typed in quick so may have syntax errors ): <xsd:simpleType name="colors"> <xsd:restriction base="xsd:string"> <xsd:enumeration...
0
by: Fender Mussel | last post by:
Hi all, Is it possible to check the content of a mixed type? I would like to define an enumeration for it. The following example works syntactically, but XMLSpy does no checks on the content at...
1
by: Sergey Poberezovskiy | last post by:
Hi, I have a simple enumeration in my schema: <xs:element name="el_1"> <xs:simpleType> <xs:restiction base="xs:string"> <xs:enumeration value="value and space 1"/> <xs:enumeration...
3
by: Antoine Junod | last post by:
Hello, I definitely have a problem to build a clean data structure. I would be very happy if some of you could help me as well as in the past. Here is my problem: -> I have a list of...
4
by: Marshal | last post by:
Sure... IEnumerable was inconvenient suggesting a separate class to service the enumeration, IEnumerator, and multiple operations: Current, MoveNext, Reset. (I'll warp the definition of "operation"...
3
by: Sampson | last post by:
I have a question about enumeration and how to populate them during runtime. I am using vb.net but will happily take any advice in c# as well. Here is an example to help illustrate what I am...
27
by: Ben Finney | last post by:
Antoon Pardon wrote: > I just downloaded your enum module for python > and played a bit with it. IMO some of the behaviour makes it less > usefull. Feedback is appreciated. I'm hoping to...
1
by: news.microsoft.com | last post by:
Hello, i got this attribute <xs:attribute name="jour"> <xs:simpleType> <xs:restriction base="stypeJour"> </xs:restriction> </xs:simpleType> </xs:attribute>
2
by: cj | last post by:
I see in VB.net 2003's help MessageBoxButtons enumeration, MessageBoxDefaultButton enumeration, MessageBoxIcon enumeration, and MessageBoxOptions enumeration but I don't see a listing of the...
1
by: stran | last post by:
I'm trying to create a simple type that holds two different types. The first is IDREF and the second is an enumeration of string. When I generate a sample xml, I can enter any ID previously stated in...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.