The other answers are correct (the compiler does not let you pass a string as an argument to a method expecting a string array), but an alternative approach is to change the method signature of your Main
method like so:
static void Main(params string[] arg)
The params
keyword allows arguments to be passed in separately instead of an array. Thus, the following calls would be equivalent:
Main("month");
Main(new string[] {"month"});
Incidentally -- while it is legal, it is not common to call the Main
method (your program's entry point) from your own program. Depending on your requirements, you may want to consider a new method that has only a single string as an argument, e.g.:
public static void MyMethod(string s)
{
// your code
}
// in your Main method
MyMethod("month");