Chapter 1 of C #, my first C # program,

Source: Internet
Author: User

Chapter 1 of C #, my first C # program,

Chapter 1.C #Getting started

1.1. NETAnd C #

001.. NET is short for Microsoft. NET. It is a technology based on Windows platform.

002 ... NET Framework is a multilingual platform for creating, deploying, and running applications.

003.IDE (Itergrated Developer Environment) integrated development Environment

004.The. NET Framework can run in multiple languages C # is only one of multiple languages

005. Like the help documentation in JAVA, MSDN is also available in. NET.

MSDN provides two methods for help:

Online: http://www.msdn.microsoft.com/zh-cn/default.aspx

Offline installation: install it on a computer with an installer

1.2How to compile C # Program

01.Start Visual Studio 2012 (select Visual C # Development Environment)

02.Create a project

03.Generate executable files

04.Start running

1.3C #Constants and variables in

01.The variable declaration method in C # is the same as that in JAVA

Data variable name;

C #Variable naming rules in:

1. Use English letters, numbers, underscores (_), and cannot contain any other character.

2. It can only start with a letter or underline

3. You cannot use the keywords in C # To use the camel naming method.

02.Constant: the amount that remains unchanged during the running of the program.

Syntax:

Const data type constant name = value;

Constant naming rules:

01 constant naming must have some practical significance

02 it is best to name constants with uppercase letters, which can be connected by underlines.

03. It is recommended that the constant name should not exceed 25 characters; otherwise, the readable row is very bad.

1.4ConsoleClass

Console. WriteLine(); Line feed output

Console. Write(); No line feed output

Console. ReadLine ();Returns a string type.

Int. Pase ()The method is to convert the string to an integer.

1.5Class and Object

01.Custom Method

Syntax:

Access modifier return value type method name (parameter list)

{

// Method subject

}

Private (Private) modified fields and methods can only be used in this class

Parameter declaration in LIST parameters: type parameter names are separated by commas (,).

02.Understanding classes and objects

C #Syntax for defining classes in:

Access modifier class Name

{

// Subject of the class

}

The class in C # can contain fields, attributes, and methods.

Fields are encapsulated and attribute attributes exist. This means that data cannot be modified logically. For details about attributes, see the next chapter.

03. C # annotation type

Line comment ://

Block comment :/**/

Document Note: // start

04 massive code folding Technology

# Region

# Endregion shortcut: ctrl + k + s

03 Visual StudioDebugging skills:

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.