Ylbtech-languagesamples-hello World

Source: Internet
Author: User

Ylbtech-microsoft-csharpsamples:ylbtech-languagesamples-hello World

1.A, example (sample) back to top
"Hello World" example

This example shows several versions of the Hello World program written in C #.

Safety Instructions

This code example is provided to illustrate a concept that does not represent the most secure coding practice, so you should not use this code example in an application or Web site. Microsoft assumes no responsibility for incidental or consequential damages arising from the use of this code sample for other purposes.

To build and run the "Hello World" sample in Visual Studio
    1. Open the solution (HelloWorld.sln).

    2. In Solution Explorer, right-click the HelloWorld1 project and select Set as Startup Project.

    3. On the Debug menu, click Start Without Debugging.

    4. Press any key to close "HelloWorld1".

    5. In Solution Explorer, right-click the HelloWorld2 project and select Set as Startup Project.

    6. On the Debug menu, click Start Without Debugging.

    7. Press any key to close "HelloWorld2".

    8. In Solution Explorer, right-click the HELLOWORLD3 project and select Set as Startup Project.

    9. In Solution Explorer, right-click the HELLOWORLD3 project, and clicking Properties.

    10. Open the Configuration Properties folder and click Debug.

    11. Type "A B C D" in the Command line Arguments property, and then click OK.

    12. On the Debug menu, click Start Without Debugging.

    13. Press any key to close "HelloWorld3".

    14. In Solution Explorer, right-click the HELLOWORLD4 project and select Set as Startup Project.

    15. On the Debug menu, click Start Without Debugging.

    16. Press any key to close "HelloWorld4".

To build and run the Hello World sample from the command line
    1. Use the Change Directory command to go to the HelloWorld directory.

    2. Type the following command:

       CD HELLOWORLD1CSC hello1.cshello1 
    3. Type the following command:

       CD. \HELLOWORLD2CSC Hello2.cshello2 
    4. Type the following command:

       CD. \HELLOWORLD3CSC Hello3.cshello3 A B C D 
    5. Type the following command:

       CD. \HELLOWORLD4CSC Hello4.cshello4 
1.B, sample code back to top

1.b.1, Hello1.cs

//Copyright (C) Microsoft Corporation. All rights reserved. //This code is published in compliance with//Microsoft Public License (MS-PL,http://opensource.org/licenses/ms-pl.html) of the terms. ////Copyright (C) Microsoft Corporation. All rights reserved. //Hello1.cs Public classhello1{ Public Static voidMain () {System.Console.WriteLine ("Hello, world!."); }}
View Code

1.b.2,

1.B, sample code 2 (sample codes) back to top

1.b.1, Hello2.cs

//Copyright (C) Microsoft Corporation. All rights reserved. //This code is published in compliance with//Microsoft Public License (MS-PL,http://opensource.org/licenses/ms-pl.html) of the terms. ////Copyright (C) Microsoft Corporation. All rights reserved. //Hello2.csusingSystem; Public classhello2{ Public Static voidMain () {Console.WriteLine ("Hello, world!."); }}
View Code

1.b.2,

1.B, sample code 3 (sample codes) back to top

1.b.1, Hello3.cs

//Copyright (C) Microsoft Corporation. All rights reserved. //This code is published in compliance with//Microsoft Public License (MS-PL,http://opensource.org/licenses/ms-pl.html) of the terms. ////Copyright (C) Microsoft Corporation. All rights reserved. //Hello3.cs//parameter: A B C DusingSystem; Public classhello3{ Public Static voidMain (string[] args) {Console.WriteLine ("Hello, world!."); Console.WriteLine ("You entered the following {0} command line arguments:", args.      Length);  for(intI=0; I < args. Length; i++) {Console.WriteLine ("{0}", Args[i]); }   }}
View Code

1.b.2,

1.B, sample code 4 (sample codes) back to top

1.b.1, Hello4.cs

//Copyright (C) Microsoft Corporation. All rights reserved. //This code is published in compliance with//Microsoft Public License (MS-PL,http://opensource.org/licenses/ms-pl.html) of the terms. ////Copyright (C) Microsoft Corporation. All rights reserved. //Hello4.csusingSystem; Public classhello4{ Public Static intMain (string[] args) {Console.WriteLine ("Hello, world!."); return 0; }}
View Code

1.b.2,

1.C, (free Download) back to top

Ylbtech
Source: http://ylbtech.cnblogs.com/
This article is copyright to the author and the blog Park, Welcome to reprint, but without the consent of the author must retain this paragraph, and in the article page obvious location to the original link, otherwise reserves the right to pursue legal responsibility.

Ylbtech-languagesamples-hello World

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.