在C#中,你可以用Dictionaries
工作(不是陣列):
// First (as you've mentioned in the comment) you need a Card class
public class Card {
public String Suit { get; private set; }
public String Value { get; private set; }
public String Face { get; private set; }
...
}
// An so you have a dictionary solution
Dictionary<string, List<Card>> cards = new Dictionary<string, List<Card>>() {
{"Player", new List<Card>()},
{"Dealer", new List<Card>()}
};
或者,如果你想陣列你應該把它放在不同的(但它是一個combersome設計):
// ... or array solution
Tuple<String, List<Card>>[] cards = new Tuple<String, List<Card>>[] {
new Tuple<String, List<Card>>("Player", new List<Card>()),
new Tuple<String, List<Card>>("Dealer", new List<Card>())
};
它不會持有卡作爲一個字符串,但insi de「播放器」會有不同的數組,每個數組包含一個面部鍵,數值鍵和套裝鍵 – Ali