为什么我在终端中运行它时,在 VS Code 中看不到我用 C# 编写的程序的输出

Rok*_*ana 5 c# visual-studio-code

我是 C# 的新手,我正在 VS 代码中做一些简单的练习。

我有一个颜色数组和一个返回输入颜色的相应索引的方法(电阻颜色练习)。

我想在终端中运行程序时看到程序的结果,但没有显示!

例如,当我选择“棕色”作为该方法的输入时,我希望在终端中看到 1。

如果有人可以检查我编写的代码有什么问题,我将不胜感激。

using System;

public class ResistorColor
{
    private void  Main(string[] args)
    {
        int a = ColorCode("brown");
        Console.WriteLine(a.ToString());
    }

    public static string[] colors = {"black", "brown", "red", "orange", "yellow", "green", "blue", "violet", "grey", "white"};
    public static int ColorCode(string color)
    {
       return Array.IndexOf(colors, color);
    }

    public static string[] Colors()
    {
        return colors;
    }

}
Run Code Online (Sandbox Code Playgroud)