Suit flushSuit = playDeck.GetCard(hand * 5).suit;
-----》这句话可以看成Ch10CardLib.Card card = playDeck.GetCard(hand * 5);
Suit flushSuit = card.suit;GetCard返回Card,而suit是Card的属性

解决方案 »

  1.   

    代码太长了,懒得看,楼主想大家help你what?
      

  2.   

    天啊,我先把你控台程序重贴一下吧,加着html太难读了.
    using System;
    using System.Collections.Generic;
    using System.Text;
    using Ch10CardLib;namespace Ch10CardClient
    {
        class Class1
        {
            static void Main(string[] args)
            {
                while (true)/*这不是死循环了吗?后面也没有什么可以退出循环的啊?*/
                {
                    Deck playDeck = new Deck();
                    playDeck.Shuffle();
                    bool isFlush = false;
                    int flushHandIndex = 0;
                    for (int hand = 0; hand < 10; hand++)
                    {
                        isFlush = true;
                        Suit flushSuit = playDeck.GetCard(hand * 5).suit;/*这是什么意思,GetCard是playDeck的方法,那suit又是GetCard的什么?还有,GetCard中的参数,hand乘以5是个什么用意?*/
                        for (int card = 1; card < 5; card++)
                        {
                            if (playDeck.GetCard(hand * 5 + card).suit != flushSuit)
                            {
                                isFlush = false;
                            }
                        }
                        if (isFlush)
                        {
                            Console.WriteLine("Flush!");
                            for (int card = 0; card < 5; card++)
                            {
                                Console.WriteLine(playDeck.GetCard(flushHandIndex + card));/*flushHandIndex在本类中就出现两次,一次是这,另一次是上面,声明并赋值为0。那既然是0,有没有它都没有什么影响啊,干嘛还要多个变量出来?*/
                            }
                        }
                        else
                        {
                            Console.WriteLine("No flush.");
                        }
                        Console.ReadKey();
                    }
                }
            }
        }
    }
      

  3.   


    首先,我要说明一下,这不是我写的代码
    然后,我说的那点,没有break
    最后,我知道break可以退出循环,还有continue、return
      

  4.   


    经过你的解释,我再回头的仔细观察,明白了这一点
    GetCard是Deck类的一个方法,该方法返回类型为Ch10CardLib.Card
    而suit是Card类的一个公共、只读、枚举,字段。但,“还有,GetCard中的参数,hand乘以5是个什么用意?”
      

  5.   

    难道加颜色是这样?

    while (true)
    <span style="color:#FF0000">
    while (true)
    </span>
      

  6.   

    你那个readonly怎么付值了,没有编译错误?
      

  7.   


    readonly是不能赋值的
    只能在两种情况下得到值
    一是,在声明的时候
    二是,通过构造函数(即,此题所用的方法)