using System;
using System.Collections.Generic;
using System.Text;
namespace ConsoleApplication1

{
    class Program
    
{
        /**//// <summary>
        /// 函数:给定一个集合,求出其所有子集合
        /// </summary>
          private static List<string> printList(string[] arr, int num)
        
{
            if (num < 0)
            
{
                List<string> reto = new List<string>();
                reto.Add("");
                return reto;
            }
            else
            
{
                List<string> ret = printList(arr, num - 1);
                List<string> addRet = new List<string>();
                ret.ForEach(delegate(string x) 
{ addRet.Add(x +" "+ arr[num]); });
                ret.AddRange(addRet);
                return ret;
            }
        }
        static void Main(string[] args)
        
{
            //演示
            string[] arr =
{ "a", "b", "c"};
            List<string> ret = printList(arr, 2);
            ret.ForEach(delegate(string x) 
{ Console.WriteLine(x); });
            Console.Read();
        }
    }
}
                    
                
                
                
            
        
浙公网安备 33010602011771号