I am newbie to C# and I'm doing some easy practices in VS code.
I have an array of colors and a method that returns the corresponding index of the inputted color(Resistor Color exercise).
I want to see the result of the program when I run the program in the terminal, but nothing shows!
For example, when I choose the "brown" as an input for the method, I expect to see the 1 in the terminal.
I appreciate if anyone can check what is wrong with the code I wrote.
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;
}
}