How to generate Variations with repetition recursively in C#

// 1: [0, 0]
// 2: [0, 1]
// 3: [0, 2]
// 4: [1, 0]
// 5: [1, 1]
// 6: [1, 2]
// 7: [2, 0]
// 8: [2, 1]
// 9: [2, 2]

using System;

public static class VariationsWithRep
{
    private static int numberOfCombos;
    private static int n;
    private static int k;
    private static int[] workArr;

    public static void Main()
    {
        n = 3;
        k = 2;
        workArr = new int[k];

        GenerateVariationsWithRep();
    }

    private static void GenerateVariationsWithRep(int index = 0)
    {
        if (index >= k)
        {
            PrintCombo();
            return;
        }

        for (int i = 0; i < n; i++)
        {
            workArr[index] = i;
            GenerateVariationsWithRep(index + 1);
        }
    }

    private static void PrintCombo()
    {
        Console.WriteLine($"{++numberOfCombos}: [{string.Join(", ", workArr)}]");
    }
}