Jak wpisywać zestawy dla danego ciągu [duplikat]

Możliwy duplikat:
Jak mogę uzyskać wszystkie możliwe kombinacje podzbioru?

Próbuję wpisać zestawy dla danego ciągu, na przykład „123” da {1} {2} {3} {13} {23} {12} {123} {}, ale mój kod daje mi 1 1 Proszę Ktoś mi powie, dlaczego i pomóż mi to naprawić. Dziękujemy wszystkim

using System;
using System.Collections.Generic;
using System.Linq; 
using System.Text;

namespace TestAAD
{
class Program
{
    static List<string> sets = new List<string>();
    static int len = 0;

    private static void Generte_Sets(string str, int i)
    {

        sets.Add(str[i].ToString());

        if (i < len)
            Generte_Sets(str, i + 1);
        else
        {
            for (int j = 0; j < sets.Count; j++)
                Console.Write(sets[j]);
            Console.WriteLine();
        }

        sets.Remove(str[i].ToString());  
        if (i < len)
            Generte_Sets(str, i + 1);
        else
        {
            for (int j = 0; j < sets.Count; j++)
                Console.Write(sets[j]);
            Console.WriteLine();
        }
    }

    static void Main(string[] args)
    {
        string set = "123";

        Generte_Sets(set, 0);
        len = set.Length;
        for (int i = 0; i < sets.Count; i++)
        {
            Console.WriteLine(sets[i]);
        }
    }
}

}

Potrzebuję pomocy, aby wpisać zestawy Potrzebuję szybkiej pomocy dzięki Wszystkim

questionAnswers(1)

yourAnswerToTheQuestion