I’m looking to see how I can run C# without the Top Levels statements, so it just runs without having to refer to ‘Main’ for it.
Also, I don’t see a search button anywhere on the community forums. I haven’t been to this website since 2021 so please excuse the clumsiness while I try to navigate these forums.
Do you mean in general, or when you solve Exercism tasks?
In the C# track, Exercism doesn’t require you to write a program at all. Instead, you are meant to implement the task’s solution in class methods.
Exercism provides the basic C# class containing stubs for the methods you are meant to implement. The test runner will call the class’s static methods (or instantiate the class and the call its class methods), so there’s no need for either top-level statements or a
That said, you can add a
Program.cs file with either
main or top-level statements to do whatever you want with the class. That may be useful for debugging or whatnot, but it’s not necessary.
This question was cross posted and is being discussed in that other thread. Please continue the discuss there.