Integrate multiple C # console programs into one console program to run

Source: Internet
Author: User

The day before yesterday, after learning the basic syntax of C #, Mr. Tian asked us to change the exercise questions implemented in Javascript some time ago to the console in C #.Program. Since JavaScript and C # both belong to the C language, the syntax between them is very similar, so it is easier for me to rewrite them into the C # language implementation! However, in the evening, Mr. Tian told me that the exercises I completed did not meet his standards. He asked me to write these eight exercise questions into a class file and call them in the same main method. At that time, I felt that this problem was a bit tricky. To call different methods in a class, you can set them to static methods to directly call them, but all of them are written in the main method, how can we control the timing of method calls? Isn't it all called once written in the main method? Different buttons cannot be used here through their onclick time. Instructor Tian prompts us to enter different parameters in the console. From last night to this morning, I have been worried about a problem. That's my integration.CodeThe file can be compiled successfully by F9 under sharpdevelopide. However, when F5 is running, the console window will flash and there is no chance to input it to me. I found a lot of information about the main console parameters on the Internet. At first, I thought that the console command line parameters should be obtained through the user input value in the program. Later I found that they were incorrect, the string [] ARGs parameter of the main method is passed in when the system is called, but it is obtained through user input in the console program. So what's wrong? I started to turn to the code I wrote and found that the output was 0 with a simple console. writeline (ARGs. length. At the prompt of teacher Tian, I finally suddenly realized that the command line parameters can only be obtained on the console. Here, they can only be compiled and run in the SDK command line window, the CSC compiler cannot be found in the DOS window that comes with Windows XP. Therefore, it is reasonable to configure environment variables before running Java programs under JDK. Enter the directory where the project source file is located under the SDK, and then type the CSC source file name .cs. of course, after csc, you can compile the. exe file with a number of different functions, and then call different methods with the different parameters you have defined in the program!

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.