473,387 Members | 1,364 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,387 software developers and data experts.

Enum with string values

VB
I want to return string values like below

public enum PropType

{
All = "A",
Mature = "M"

}

Is this possible at all? Is there any elegent way to return string
values using enum?
Nov 15 '05 #1
2 6726
Sounds like what you want is constants, not enums.

const char All = 'A'
const char Mature = 'M'
....

Pete
--
http://www.petedavis.net
"VB" <vb*****@sbcglobal.net> wrote in message
news:be*************************@posting.google.co m...
I want to return string values like below

public enum PropType

{
All = "A",
Mature = "M"

}

Is this possible at all? Is there any elegent way to return string
values using enum?

Nov 15 '05 #2
> I want to return string values like below

public enum PropType

{
All = "A",
Mature = "M"

}

Is this possible at all? Is there any elegent way to return string
values using enum?


You should be able to do it with chars, since they just map to integers:

public enum...
{
All = 'A'
Mature = 'M'
};

Isn't possible with strings.
Nov 15 '05 #3

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

Similar topics

0
by: Patrick Guio | last post by:
Dear all, I wonder whether anyone might have a better idea/solution to the following. I need an associative container <int,string> for a limited and defined number of values (enum-like) but ir...
9
by: Lawrence Oluyede | last post by:
I have a list of strings and i'd like to build up an enum from them... is there a way to do that? Thanks in advance. -- Lawrence "Rhymes" Oluyede http://loluyede.blogspot.com
3
by: Richard | last post by:
Okay gang, This should be simple but apparently it's not... I want to use the System.DayOfWeek enum to create and access an array of objects with one object for each day of the week. I'd like...
10
by: Ken Allen | last post by:
The ToString() function, when applied to a variable that is an enumeration type, results in a string that is the name of the enumerated value that was defined in the source code. This is cool, but...
13
by: Don | last post by:
How do I get an Enum's type using only the Enum name? e.g. Dim enumType as System.Type Dim enumName as String = "MyEnum" enumType = ???(enumName)
0
by: Ben Finney | last post by:
Howdy all, I've uploaded enum 0.3 to the Cheeseshop. <URL:http://cheeseshop.python.org/pypi/enum/> Enumerations are now sequences, iterable (as before) *and* indexable:: >>> from enum...
7
by: Harris | last post by:
Dear all, I have the following codes: ====== public enum Enum_Value { Value0 = 0, Value1 = 10,
8
by: tony | last post by:
Hello! I have below a for loop and a switch in the for loop. I have also a enum called colBlowStep with some values. I have also an array called m_columnBlowStep with some strings. All items in...
34
by: Steven Nagy | last post by:
So I was needing some extra power from my enums and implemented the typesafe enum pattern. And it got me to thinking... why should I EVER use standard enums? There's now a nice little code...
11
by: =?Utf-8?B?dG9iaXdhbl9rZW5vYmk=?= | last post by:
The following code is in a custom deserializer: object value = (int) 1; string nameToParse = Enum.GetName(field.FieldType, value); value = Enum.Parse(field.FieldType, nameToParse); Currently...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...

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.