roy*_*esh 0 c# arrays variables visual-studio
我正在寻找以下错误的帮助:
'Practical_2.Card'是'类型',但用作'变量'
这是我的代码:
class Tester
{
static void Main(string[] args)
{
Card[] hand = {
new Card("Spade", 3),
new Card("Club", 10),
new Card("Diamond", 11),
new Card("Heart", 9),
new Card("Diamond", 13),
};
ProcessHand(hand);
}//end of static void main
static void ProcessHand(Card[] cards)
{
Console.WriteLine("{0,-10:s}: {1,-10:i}", "suit: ", Card[0]);
}//end of static void processhand
}//end of class Tester
class Card
{
public string suit { get; set; }
public int facevalue { get; set; }
public Card (string su, int fa)
{
suit = su;
facevalue = fa;
}
public void DisplayCard()
{
Console.WriteLine(suit, facevalue);
}
}//end of class Card
Run Code Online (Sandbox Code Playgroud)
我在这一行得到错误:Console.WriteLine("{0,-10:s}: {1,-10:i}", "suit: ", Card[0]);
帮助我非常感激.干杯