C #. NET study notes 2---C #. The first C # Program

Source: Internet
Author: User

C #. NET learning notes 2---C #. the first C # program technology qq Communication Group: JavaDream: 251572072 download tutorial, online communication: chuangmeng IT community: www. credream. com6. the first C # program:. single line comment: // B. multi-line comment :/*... */, note * There is no space between the two. The only three console commands to be learned are: You want to print the console: hello... using System; using System. collections. generic; using System. linq; using System. text; namespace ConsoleApplication1 {class Program {static void Main (string [] args) {Console. writeLine ("hello... "); Console. readKey (); // click the button to continue execution.} -------------------------------------------- 1. solution resource manager on the right: Release the Program of each project. cs is short for c shape; 2.c# the source file ends with cs. The entrance of c # program is the Main function. Write the code in Main, don't worry about what other parts mean. 3. common Errors: No semicolon at the end, Case sensitivity error 4. display the code line number; Select menu bar -- tool --- option --- left-side text editor --- C # -- check the line number; 5. a. c # Syntax: Execute B from top to bottom. case Sensitive c. function parameters are enclosed by (). d. use semicolons (;) to separate two sentences (error: full angle problem) e. note: single line comment and multi-line comment; ------------------------------------------------- 1. variable: Data Type: string, int, char, decimal, byte, double, long, float; string escape: \ backslash, linefeed: "a \ nb ", at this time, \ n refers to a line break "\ AB" which can output: \ AB;. c: \ temp \ files \ imag.jpg, which is used for escape; string s = @ "\\\" // note @ indicates that \ In the string is not treated as an escape character; using System. collections. generic; using System. linq; using System. text; namespace ConsoleApplication2 {class Program {static void Main (string [] args) {/* int I = 10; Console. writeLine (I); string name = Console. readLine (); Console. writeLine (name + "hello... "); */string s =" \ "a \ nb \""; string s = @ "\\\" // note @ indicates that \ In the string is not considered as an escape character;, @ is only meaningful to the \ Escape Character Console. writeLine (s); Console. readKey ();}}}

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.