C # basic organization 1

Source: Internet
Author: User

1. Concept

(1). Net/DOTNET: generally refers to the. netframework framework, a platform and a technology.

(2) C # (sharp):Programming LanguageTo develop applications based on the. NET platform.

(3) Java is a programming language.

    1. Integrated Development Environment (IDE)
    2. Note in C #:ProgramAnnotations:

First, the single line comment starts with // and ends at the end of the line.

Type 2: multi-line comments/* Start, */end, all comments

Third, document comments are used to annotate classes or methods. Enter // before the class or method to display all the comments.

    1. . Net is a multi-language platform. Development. Net can be performed in dozens of languages.

Java is a single-language platform with multiple languages.

    1. Microsoft intermediate language (msil)
    2. Variable

(1) The computer uses memory to store data.

(2) variables represent a piece of memory space. We can store/retrieve data from memory using the variable name. If there is a variable, we do not need to remember the complex memory address.

(3) syntax for applying for a memory space from memory: data type variable name;

Example: int I; I = 100; double PI; Pi = 3.14;

Note: In the C # development environment, write a number with a decimal point. This number is of the double type. Add m/m after a decimal point, it tells the compiler that the number is of the decimal type.

Three methods for variable declaration:

1) declare it first and assign a value to it. Int A; A = 3;

2) assign values directly when defining variables. Int A = 3;

3) declare multiple variables of the same type at a time. Separate multiple variables with commas (,) and end.

String zsname, lsname, wwname; int zsage = 18, lsage = 20; wwage = 30;

Note: The variable must be declared first, then assigned a value, and finally used (value/or call or write this variable name)

    1. When to use escape characters

When we need to enter some special characters in a string, such as quotation marks, line breaks, and unspaces, we need to use escape characters.

An escape character is a character with a "\" + a letter to form a character of special significance.

    1. When a value assignment operator or arithmetic operator performs an operation, the type of the operand to be involved in the operation must be the same, and the operation result must be of the same type as that of the operand.
    2. How to complete exception capture in C #

Try

{Errors may occur.CodeWritten here}

Catch
{Error message (processing after an error )}

How to execute the above program:

If there is no error in the code in try, the program runs normally and does not execute the content in catch.

If an error occurs in the code in try, the program immediately jumps into catch to execute the code, the code after the error code in try will not be executed.

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.