How can I test how my Main method handles command-line arguments in Linqpad? I tried
void Main(string[] args)
{
    args.Dump()
}
but it errors
No overload for method 'Main' takes 0 arguments
Edit: I don't want to run Linqpad from the command-line (that would be tedious), I just want to supply args to the main method somehow (so I can quickly test a Main method). Perhaps like this mock-up:

void Main (string[] args)
{
    #if !CMD
        args = new[] { @"arg1", @"arg2" };
    #endif
    args.Dump();
    ...
                        Why don't you do this:
void Main()
{
    var args = new string[] { "arg_one", "arg_two" };
    subMain(args);
}
// Define other methods and classes here
public void subMain(string[] args){
    args.Dump();
}
                        If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With