Black Horse programmer _ watch video note _ C # programming basics 01

Source: Internet
Author: User
Tags visual studio 2010

No.: Notes downloading black horse programmer _ watch video notes _ 1-10

Concept:. netAnd C #

L. Net/DOTNET: generally refers to the. NET Framework framework, a platform and a technology.

L c # (C sharp): a programming language that can be used to develop applications based on the. NET platform.

L (*) Java: A technology and a programming language


C sharp indicates sharp. c ++ indicates two well numbers (#) and C # indicates four well numbers (#)


. NetWhat can we do?

L desktop application winform

L Internet application ASP. NET/WebService

L mobile development WP7 and WP8

Namely: Embedded Development WindowsCE/WinCE


(*) There is no winform concept in Java.

(*) Using. Net to develop winform is to develop desktop applications

(*) Using. Net to develop websites is to develop ASP. NET programs, that is, Internet applications.

(*) Comparison between windowsphone and Android and IOS


Architecture/mode (generally refers to the network program, regardless of the single-Host Program)

C/S: Client/Server mode-> winform

B/S: Browser/Server mode->


What Microsoft often does later

Java is a language in 1990s, and C # is a language from 2k01-2k02.


. NetDevelopment Learning route


Jquery is a javascript framework and class library.



Integrated Development Environment (IDE)

Introduction to Visual Studio 2010:

1. A complete set of development tools

2. Used to develop desktop applications, ASP. NET
Web applications, XML, Web Services, and mobile applications

3. powerful support for rapid development




IDE and. Net versions (* understanding)


. NET 1.0-Visual


. NET 1.1-Visual
Maxcompute Studio 2003


. NET 2.0-Visual
Maxcompute Studio 2005


. Net 3.x-Visual
Maxcompute studio 2008


. Net 4.x-Visual
Maxcompute studio 2010



The maximum vs2008 version is team system.

(*) Chinese laws and regulations: cracking and decompilation for the purpose of research and learning is not legally liable for waiting for verification



The full name of msdn is Microsoft
Developer Network. This is an information service provided by Microsoft for software developers. Msdn is actually
Visual Studio and
The Windows platform is the core integrated virtual community for development, including technical documents, online electronic tutorials, Web virtual labs, and Microsoft Product downloads (official and beta versions of almost all operating systems, server programs, applications, and development programs, it also includes various driver development kits and Software Development kits), blog, BBS, msdn webcast, and
CMP cooperation
Msdn magazine and other services.




Introduction 1

Install setup.exe install.exe Autorun


Create a solution/Project

View various parts of vs (menu/shortcut key/toolbar/window)

Enable Visual Studio views and reset the development environment

C # source files (classes) generally end with CS

C # the entry of the program is the main function. You just need to write the code in the main function.


Introduction 2

L save the project, open the project, and submit the files submitted by the job.

L job naming format: su Kun 813.rar

L learn two sentences first:

N console. writeline ("Hello, world! ");

N console. readkey ();

N each sentence ends with a; sign.

N run the. exe program generated by the worker.

L set the font and row number display

L create multiple projects

L startup Project Settings

L project loading and unloading


Reset Development Environment

Tools> Import and Export


. Sln solution file

. Csproj project file


(*) W + Tab


C #Annotator in

L // single line comment

L /*

Multi-line comment


L ///

/// Document comment






In C #, what is a comment? Write comments to the program we wrote. The comments are for you!


First, the single line comment starts with //, followed by the comment content

Type 2: Comments starting with/*/end with comments

Third: comment the document into a line above the method or Class



Program the following:




Basic computer skills

L introduction to common components: Home/end/Pageup/Pagedown/shift/Ctrl + home/Ctrl + end

L delete a Text Segment: delete/backspace

L Ctrl + A Ctrl + k/F

L learn to use copy and paste. CTRL + C/V/x

L confusion about the insert and overwrite modes. Insert

L learn to use Ctrl + Z to cancel the last operation

L;, () "" and so on. Error: Unexpected character ""

L vs window dragging

L do not report exceptions or errors.

L shortcut keys frequently used at present: F5 F6

L # region and # endregion



. Net Development Environment (*)


Development tools: Visual Studio


C # VB. net f # VC ++. net

C sharp. net
Framework: provides library libraries.



. Net: a multi-language platform. Development. Net can be started in dozens of languages.

Java: A single-language platform.









Russia> Japan

Russia> South Korea

Russia> China

Japan> Russia

-> Korea

South Korea> Japan

South Korea
-> Russia

Search for Chinese Translation






CLR: CLS + cts

CLR: Common Language Runtime

CLS: Common
Language Specification

CTS: Common Type System


(*) VC ++



Variable 1

The computer uses memory to store data.

The data we store on the computer is similar to the data stored in a hotel.



LWe generally want to do the following in a hotel:

L1Open room (single room, double room, Presidential Suite)

L2Check in








The user stores the running program data (not prepared)

Ram: Memory features data loss after power failure


Variable: The variable represents a piece of memory space. We can store/retrieve data from the memory using the variable name. If there is a variable, we do not need to remember the complicated memory address.

In Memory



Variable 2


To store a number 1000 in a computer, you need two sentences.

Int A; // open a space where numbers can be placed.

A = 1000; // enter 1000.

Syntax format for declaring variables:

  • Data type variable name;

Value assignment: variable name = value;

Can a = 3.14 ????

Variable 3

Various types of data in computers

3.14 100The quick brown

Fox jumps over the lazy dog

Zhang SanLi Si true


Common Data Types


Write a decimal value in C. The default value is double.

Float + F/F

Decimal + M/M


[Pre-defined data types in C #]


Variable declaration method

A) Name of the data type variable;

  • Int age;
  • Variable value age = 18;

B) assign values when defining, and the data type variable name = value;

  • Int age = 18;

C) multiple variables of the same type can be declared at a time separated by commas.

  • String zsname, lsname;

Variables must be declared and assigned values before they can be used.

Exercise: Define a variable PI, store 3.14, and display it on the screen?

What is the output result of the following code?

  • Int I = 10; console. writeline ("I ");


Variable name

Naming rules:

  • 1. the name must start with "letter" _ or "@". Hungarian naming rules


    Value assignment operator and value assignment expression

    Value assignment operator: =

    A = a + 1; here the = sign is a value assignment operator, not equal to the mathematical meaning.

    Variable values can be assigned repeatedly. Once a new value is assigned to a variable, the old value in the variable no longer exists.

    Output result of the Code on the right:



    Define a variable to store the customer's name and display it on the screen: "Hello, xx ".

    • Customer Representative name
    • The + number can be used to connect two strings. The "+" number indicates the meaning of the connection.


    1. define three variables to store a person's name (Zhang San), age (28), and salary (7600.33 ). my name is XX. Today I am X years old, and my salary is XX yuan.

    2. define a variable to store a person's age (18), and then find that the person's age is not 18 years old, I want to change the age of this person to 20 years old (the variables in this question can be assigned multiple times), and finally output the age of this person to the screen?

    L 3. Define four variables to store a person's name, gender, age, and phone number. Then print it on the screen (my name is x, I am X years old, I am X student, and my phone number is XX)

    L 4. output on the screen: my mobile phone is Philips model: 998 price: 1500 Yuan weight: 0.3 kg

    L define the value stored in the variable and display it on the screen.

    L 5. Define two variables, for example, a B is assigned to 10 and 5 respectively, and the Write Program exchanges the values of the two variables.


    Placeholders can be used in the first variable/string in console. writelinea ("");

    A placeholder consists of "{number}" and a number starts from 0.

    The first placeholder {0}

    Second placeholder {1}

    Third placeholder {3 }......


    Console. when there are multiple parameters, the output is the content of the first parameter. Starting from the second parameter, it is used to replace the placeholder value in the first parameter, therefore, whether or not to output the second parameter depends on whether there are related placeholders in the first parameter.


    The phone number must be in the string type.


    After learning a sentence, it is used to let the user input a sentence from the keyboard. When the program is executed to the following sentence, it will be paused, and then wait for the user to input a sentence from the keyboard, press enter to continue executing the program. If you want to get the content entered by the user, you need to define a string type variable. Uninstall the following sentence and receive the content entered by the user.

    Console. Readline ();

    To receive user input, you must define a string for receiving.

    Input = console. Readline ();


    Escape character strings

    Can I output double quotation marks in a string?

    Display on the screen: the string in C # is included with the "" sign.

    \ + A character to form an translated character. It is generally used to represent a special symbol.

    @ Indicates that the character is not translated before the string

    Common escape characters: \ n \ B \ t \\\"


    Add @ to the front of the string @The symbol has two meanings:

    1If \Is not understood as an escape character.

    2Enable character strings to be defined by line breaks


    Arithmetic Operators and arithmetic expressions

    Arithmetic Operator: +-*/% (modulo the remainder)

    Arithmetic expression: the operator connected by arithmetic operators. For example, 1 + 1 A-B (the variable AB has been declared and assigned an initial value)

    Demonstration: The score of a student in three courses is: Chinese: 90 mathematics: 80 English: 91. The total score and average score of programming are obtained.

    Priority:Multiplication and division,Plus or minus,The brackets are included in the brackets,Operations at the same level from left to right

    Parentheses can be applied unlimitedly, but must appear in pairs.


    Exercise 1: define two numbers as 10 and 20 respectively, and print the sum of the two numbers.

    Exercise 2: calculate the area of the circle with a radius of 5 and print it out.

    Exercise 3: the price of a store T-shirt is 35 yuan/piece, and the price of trousers is 120 yuan/piece. james bought 3 T-shirts and 2 trousers at the store. Please calculate and show how much James should pay?


    Automatic type conversion rules

    L The operands involved in the operation (arithmetic operation and value assignment operation) must be of the same type as the result.
    When the following conditions are met, the system automatically converts the data types.

    L two types of compatibility

    U for example: int and double are compatible

    N target type greater than Source Type

    U for example: Double>

    L for expressions

    N if an operand is of the double type, the entire expression can be upgraded to the double type.

    N, for example, a 8.8 discount exercise question.

    N is used to calculate the remainder of 10/3.


    Forced type conversion

    In the above question, after 8.8 off, a decimal number occurs. For the convenience of settlement, the store only collects the user's integer part of the money. For example, if the user is 303.6, only 303 yuan is collected. What should I do?


    • (Data Type name) value to be converted;

    For example:

    Int B =
    (INT) 3.14;

    For forced type conversion, must the data types be compatible with the following statements?

    Int number = (INT) "3.14 ";


    Type Transformation

    Q: Ask the user to enter his Chinese and mathematics scores, calculate his total score, and display it?

    Convert is not only a memory-level conversion, but a conversion of data meaning. Convert is a process of processing and transformation.

    Convert. toint32 (can be converted to int type data) to convert other types of data to int type


    Ask the user to enter a name
    The score of the three Chinese and mathematics English courses is displayed to the user: XX. Your total score is XX, and the average score is XX.


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: 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.