Q:

How can I complete an instruction using variables?

I want to make a function that changes the colors of the console when called, with the ones I choose. I don't want to write 3 instructions every time I do that, so that's why I want it to be in a function.
So far I've done something similar to this:
public static void WindowColor(string Background, string Foreground)
{
    Console.BackgroundColor = ConsoleColor.Background;
    Console.ForegroundColor = ConsoleColor.Foreground;
    Console.Clear();
}

static void Main(string[] args)
{
    WindowColor("DarkCyan","White");
}

where ConsoleColor.Background and ConsoleColor.Foreground I want to be replaced with ConsoleColor.DarkCyan and ConsoleColor.White, as I called in WindowColor("DarkCyan","White");.
But I get this error: 

'ConsoleColor' does not contain a definition for 'Background'.

Now I get the fact that Background in ConsoleColor.Background is not seen as a variable, but rather as a part of the instruction, but the question is: How can I make Background or Foreground be seen as a completion of the instruction in the form of a variable?

A:

Normally, you would just use the correct type of parameter instead of string:
public static void WindowColor(ConsoleColor background, ConsoleColor foreground)
{
    Console.BackgroundColor = background;
    Console.ForegroundColor = foreground;
    Console.Clear();
}

static void Main(string[] args)
{
    WindowColor(ConsoleColor.DarkCyan, ConsoleColor.White);
}

If you insist on it having strings as parameters, you will have to parse them:
public static void WindowColor(string Background, string Foreground)
{
    Console.BackgroundColor = (ConsoleColor) Enum.Parse(typeof(ConsoleColor), Background, true);
    Console.ForegroundColor = (ConsoleColor) Enum.Parse(typeof(ConsoleColor), Foreground, true);
    Console.Clear();
}

static void Main(string[] args)
{
    WindowColor("DarkCyan","White");
}

