您将如何转换此代码
poker_deck = [r+s for r in '23456789TJQKA' for s in 'SHDC']
到 C#?
我提出了这个:
char[] figures = "23456789TJQKA".ToCharArray();
char[] suites = "SHDC".ToCharArray();
List<string> deck = new List<string>();
foreach (var figure in figures)
{
foreach (var suite in suites)
{
deck.Add(string.Format("{0}{1}", figure, suite));
}
}
你怎么看?我想在一个简单易读的行中做同样的事情