[Solved] Generate Every Possible 2 Character Combination [duplicate]


Create an array of all your characters and then do a nested foreach loop to generate each possible combination.

static void Main()
{
    IList<char> characters = new List<char> {'a', 'b', 'c', 'd', 'e', 'f', 'g', '1', '2', '3'};
    foreach (char c1 in characters)
    {
        foreach (char c2 in characters)
        {
            Console.WriteLine(new string(new[] {c1, c2}));
        }
    }
    Console.ReadKey(true);
}

4

solved Generate Every Possible 2 Character Combination [duplicate]