Initial C #

Source: Internet
Author: User

I. IDE operating environment vs.

1. To create a solution step:

1.1 Click File---> New---> Select Console Application under Window

2. Create a project step:

2.1 Click Solution---> Right---> New project---> select Console Application under Window

3. Setting up the Startup Project

3.1 Click the project you want to start right-click Set to Startup Project

Two. Data types in C #

1.int Integral type
float Float Type
String type
BOOL Boolean type

Naming rules for variables in 2.c#

2.1 Composition: Letters, numbers, underscores _
2.2 Opening: Letters, "_"
2.3 Cannot use keywords
2.4 See the meaning of the name

Constants in the 3.c#
Const data type variable name = value;
※ Constants once declared cannot be changed

Constant naming rules:
Make sense
All caps
Length should not be too long

Three. Console class

Console.WriteLine () Method--line wrapping after output
Console.Write () Method--No line break after output
Console.ReadLine () method, return value is String type
String Name=console.readline ();
int Age=int. Parse (Console.ReadLine ());

Several ways to output to the console:

Console.WriteLine ();//equivalent to line break
Console.WriteLine (the value to output); Output a value
Console.WriteLine ("Format string", variable list);
Console.WriteLine ("My course name is: {0},{1}", Course,score);
Four. Classes and objects

A class is an abstraction of an object that is an instance of a class
public class Student
{
public string name;
public int age;
public void Show ()
{
Console.WriteLine ("Name: {0}, Age: {1}", name,age);
Console.ReadLine ();
}
}
Student stu = new Student ();
Stu.name = "Zhang San";
Stu.age = 20;
Stu. Show ();

Methods in a class
Access modifier return type method name (parameter list)
{
The body of the method ...
}
Access modifier: Public Private
return type: int double char void ....
Method Name: Follow the Pascal nomenclature, capitalize the first letter
Five. Annotations in C #
#region
.......
#endregion

Six. VS Debug

Breakpoint (Breakpoint)
Notifies the debugger that an application should be interrupted at some point and that execution is paused

Monitoring (Watch) window
Calculating values for variables and expressions

debugging common shortcut keys
f5-Start Debugging
shift+f5-Stop Debugging
f9-setting or deleting breakpoints
f10-Process-wise execution
f11-statement

Initial C #

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.