Click here to Skip to main content
15,940,271 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello, I have a problem creating an enumerator for some special characters...

So how can I achive the following(if its possible of course):

public enum MyEnumerator
    InboundDocument = ->,
    OutbountDocument = <-,
    MyOwnDocument = v 

Thank you for your answer...
Updated 10-Jul-12 22:40pm
Rahul Rajat Singh 11-Jul-12 4:36am    
Your question is not clear. and what is this code you provided. This is now how an enum is defined.
pykos 11-Jul-12 4:41am    
Sorry I mixed the order, the question is how to use "->" this kind of character in enumerator?

That is not how enum works. Enum can map an integral value to named constants, that are identifiers, thus have to conform to following syntax rules:[^]. On the other hand, values has to be integral type, see:[^]
You can however add attributes, and read them with reflection. Look here:[^]
Share this answer
Share this answer
I think this might work

public enum MyEnumerator
    InboundDocument = 0,
    OutbountDocument = 1,
    MyOwnDocument = 2

Share this answer
After you clarification you probably need something like this:

public sealed class DocumentFlowDirections
	    public const string InboundDocument = "->";
	    public const string OutbountDocument = "<-";
	    public const string MyOwnDocument = "v"; 
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900