第252152条 - C#/ Netx 4.0中的纸牌游戏 [英] Article 252152 - Solitaire Game in C#/Netx 4.0

查看:80
本文介绍了第252152条 - C#/ Netx 4.0中的纸牌游戏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图按照文章252152(Solitaire)中的例子进入第三个cs fie我收到了一个错误。代码段位于PlayingCard.cs模块中,其中代码试图根据枚举类型的int位置派生Suit。



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

行是:



int enumval =(int)CardType;



单词CardType有一个红色下划线。



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

当鼠标悬停在它上面时,错误信息显示为:



enum Sol.CardType

卡类型。



错误

Sol.CardType是一个类型但是像变量一样使用。



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



我检查了拼写,特别注意大写和小写。我下载的示例代码(放在不同的文件夹中)有完全相同的代码。那么为什么这一行在示例代码中显示没有错误,我的BUT有错误?我的意思是我在CardTpye.cs中看到同名的枚举类型被声明,所以我理解错误信息。我不明白为什么它在您的示例代码中有效?

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?

推荐答案

不要发布t他的快速答案 - 如果您从文章中获得了代码,那么该文章底部会出现一个新消息按钮,这会导致将电子邮件发送给作者。然后他们会被告知你希望与他们交谈。

在这里发布这个依赖于他们匆匆而过并意识到这是为了他们。
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.


这篇关于第252152条 - C#/ Netx 4.0中的纸牌游戏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆