static string[] m_Data = { "A", "B", "C", "D", "E" };
static void Main(string[] args)
{
Dictionary
for (int i = 0; i < m_Data.Length; i++)
{
Console.WriteLine(m_Data[i]);//如果不需要打印单元素的组合,将此句注释掉
dic.Add(m_Data[i], i);
}
GetString(dic);
Console.ReadLine();
}
static void GetString(Dictionary
{
Dictionary
foreach (KeyValuePair
{
for (int i = kv.Value + 1; i < m_Data.Length; i++)
{
Console.WriteLine(kv.Key + m_Data[i]);
dic.Add(kv.Key + m_Data[i], i);
}
}
if (dic.Count > 0) GetString(dic);
}
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/12639172/viewspace-555234/ ,如需转载,请注明出处,否则将追究法律责任。