C
C#2y ago
ilycryst

I don't really know what's the issue here? I'm am A RLLY NEW C# learner so maybe you guys can help?

5 Replies
Thinker
Thinker2y ago
Okay a few issues: 1. Main has to have the signature static void Main() or static void Main(string[] args). 2. Console is a static class, which just means that you can't pass it into a method like Main. 3. You're calling Main(argconsole, console) at the end of the Main method, which would cause the method to repeat infinitely. 4. Replace Convert.ToInt32 with int.Parse, Convert.ToInt32 shouldn't be used as it has several oddities about it. Other than that, the console looks fine.
ero
ero2y ago
$mains
MODiX
MODiX2y ago
The possible signatures for Main are
public static void Main() { }
public static int Main() { }
public static void Main(string[] args) { }
public static int Main(string[] args) { }
public static async Task Main() { }
public static async Task<int> Main() { }
public static async Task Main(string[] args) { }
public static async Task<int> Main(string[] args) { }
public static void Main() { }
public static int Main() { }
public static void Main(string[] args) { }
public static int Main(string[] args) { }
public static async Task Main() { }
public static async Task<int> Main() { }
public static async Task Main(string[] args) { }
public static async Task<int> Main(string[] args) { }
public is not required (can be any accessibility). Top-level statements are compiled into a Main method and will use an appropriate signature depending on whether args is referenced, the await operator is used and/or an explicit return statement is used. https://docs.microsoft.com/en-US/dotnet/csharp/fundamentals/program-structure/main-command-line
Main() and command-line arguments
Learn about Main() and command-line arguments. The 'Main' method is the entry point of an executable program.
Thinker
Thinker2y ago
(although you don't have to worry about the async Task ones)
Accord
Accord2y ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.
Want results from more Discord servers?
Add your server