Requirements: Generally, during the development process, programmers may encounter some problems, need to write simple test code for verification, and create a new console application. If we need to test 10 feature points and want to keep the tested code, do we want to build 10 console apps (too many solution projects), or one console app defines 10 methods to write different logic.
In order to reduce the number of items in the solution, facilitate code testing, and keep the code logic clean and clear, we can create multiple new class objects in one console, each with a Main method, as follows:
However, when compiling the project, an error will be reported as follows:
The program defines multiple entry points. Compile with /main (specifying the type that contains the entry point). We edit the project configuration and set the StartupObject parameter to solve the problem, as shown in the figure below:
The configuration is as follows:
When testing, you can modify the object name according to your own scenario.
Reference:
The hyperlink login is visible.
The hyperlink login is visible. |