C # concise tutorial (2)

zhaozj2021-02-17  63

C # concise tutorial (2)

Disclaimer: I am in translation, add some of my own opinions and some other comparisons, I hope you can make everyone understand more, understand more.

If you have any suggestions, please mail: efoxxx@263.net

By the way, the brother of "finding the C # compiler" in the expert clinic, how can I have not received the C # compiler you promised, urgent, and send me a busy busy, Thanks!

My first C # program

Lower is "My First C # Program" source code, you can knock this code in any editor, it is better to say NotePad, WordPad, and so on (of course, according to I (EFOxxx), it is best to use The editor of the VC, because it allows you to easily tell what is reserved, reducing input errors). When you type it, save it as a text file that is the extension of .cs (I assume it to save it as: myfirstcs.cs).

Now you can execute the command in the command line (DOS):

CSC myfirstcs

(I have to say a path! Which of the directory you will put myfirstcs, you will have this command. This command will build a MyFirstCs.exe file).

Perform myfirstcs.exe -

This program outputs on the console:

Hello, C # World!

Source program:

// use system

Using system;

Class Hello

{

Static void main () {// display output on Console

Console.writeline ("Hello, C # World!");

}

}

Efoxxx Supplement:

Everyone may wish to compare here with Java's Hello program, I am attached here:

Class HelloWorldApp

{

Public static void main (string [] args)

{

System.out.Println ("Hello World!"); // Display the string.

}

}

转载请注明原文地址:https://www.9cbs.com/read-31377.html

New Post(0)