日期:2014-05-17 浏览次数:20935 次
static void Main(string[] args)
{
List<int> intList = new List<int>();
intList.Add(1);
intList.Add(2);
intList.Add(3);
intList.Add(4);
List<string> strList = new List<string>();
for (int i = 0; i < intList.Count; i++)
{
Console.WriteLine(intList[i].ToString());
GetListMethod(intList, i, i+1);
}
Console.ReadKey();
}
public static void GetListMethod(List<int> intList,int n, int m)
{
for (int i = m; i < intList.Count; i++)
{
string s = intList[n].ToString();
for (int j = m; j <=i; j++)
{
s += "," + intList[j].ToString();
}
Console.WriteLine(s);
}