Solved

I want my enumeration to contain an entry like "Mail/Telephone Order". I am having an error due to  the front slash character.

Posted on 2006-07-14
3
232 Views
Last Modified: 2010-04-16
I have an enumeration and its structure looks like this:

public enum MerchantBusinessTypes
{
      Mail/Telephone Order = 1,
       Internet,
                 QSR/QPS    

}

I am having an error to define entries like 'QSR/QPS' and 'Mail/Telephone Order '. How can I define such entries containig slash characters, spaces and the like?

Thanks in advance.
0
Comment
Question by:chaleastale
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 96

Accepted Solution

by:
Bob Learned earned 125 total points
ID: 17110648
You can't.

Try using Mail_Telephone_Order or MailTelephoneOrder.

Bob
0
 
LVL 6

Expert Comment

by:PoeticAudio
ID: 17110658
you can't define them with slashes like that because that's a division operator. You might have to adjust your naming convention such as

public enum MerchantBusinessTypes
{
     Mail_or_Telephone_Order = 1,
     Internet,
     QSR_Or_QPS
}

or the like
0
 
LVL 25

Expert Comment

by:dstanley9
ID: 17110707
You can't in an enum, because they have to follow CLR member naming conventions (numbers, characters, and underscores).  Other alternatives would be a dictionary (Hashtable or Dinctionary<>, for example) or to convert all special characters to underscores.  I have done this where the enum values are displayed with spaced replacing the underscores:

public enum BusinessType
{
  Corporation,
  Limited_Liability_Company,
  ...
}

And at display time I convert the underscores to spaces.  You'd have to come up with another token to represent slashes(
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In order to hide the "ugly" records selectors (triangles) in the rowheaders, here are some suggestions. Microsoft doesn't have a direct method/property to do it. You can only hide the rowheader column. First solution, the easy way The first sol…
We all know that functional code is the leg that any good program stands on when it comes right down to it, however, if your program lacks a good user interface your product may not have the appeal needed to keep your customers happy. This issue can…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question