Click here to Skip to main content
15,887,404 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
I was trying to follow the example in article 252152 (Solitaire) and entering the third cs fie I got an error. The code segment was in the module "PlayingCard.cs" where the code was attemping to derive the "Suit" based on the int position of an enumerated type.

----------------
The line is :

int enumval = (int)CardType;

The word "CardType has a red underline.

-----------------
When hovering over it, the error message reads:

enum Sol.CardType
The Card Type.

Error
"Sol.CardType" is a "Type" but is used like a variable.

---------------------

I checked the spelling paying particular attention to upper vs lower case. and the example code I downloaded (and placed in a different folder) has the exact same code. So why does this line show NO error in the example code, BUT in mine has an error? I mean I do see in CardTpye.cs where the enum type of the same name is declared so I understand the error message. I don't understand why it works in your example code?
Posted
Comments
[no name] 15-Aug-13 11:03am    
You should be asking the author in that article's message forum.

1 solution

Don't post this under Quick Answers - if you got the code from an article, then there is a "new message" button at the bottom of that article, which causes an email to be sent to the author. They are then alerted that you wish to speak to them.
Posting this here relies on them "dropping by" and realising it is for them.
 
Share this answer
 
Comments
Dave Kreskowiak 15-Aug-13 14:05pm    
I don't know which DB down-voted you, but countered. It's a perfectly reasonable 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