在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