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
233 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

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

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…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
Suggested Courses

627 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