1. New project
sln: solution
csproj : C shap peoject
cs:class
The solution contains projects, and projects contain classes.
Method is also called function
2. Program composition
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
//using xxxx 命名空间
namespace lesson01 //项目名称
{
class Program //类
{
static void Main(string[] args) //main函数又叫main方法,程序的主入口,起始于main,结束于main
{
}
}
}
Three, the project
3.1 Set startup items
Method 1: Change in solution properties
Method 2: Right-click the project
3.2 Deleting and uninstalling the project
Four, C# comments
4.1 Line comments (//double slash)
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
//using xxxx 命名空间
//使用using语句导入命名空间时需要将其放在程序的开头。
4.2 Multi-line comments (/* */)
/*
* 第一个程序
* 注释下
*/
namespace lesson01 //项目名称
{
class Program //类
{
static void Main(string[] args) //main函数又叫main方法,程序的主入口,起始于main,结束于main
{
Console.WriteLine("第一个C#程序");
Console.ReadKey();
}
}
}
4.3 Document comments (///)
namespace lesson01 //项目名称
{
class Program //类
{
/// <summary>
/// 随便注释下
/// </summary>
/// <param name="args"></param>
static void Main(string[] args) //main函数又叫main方法,程序的主入口,起始于main,结束于main
{
Console.WriteLine("第一个C#程序");
Console.ReadKey();
}
}
}
Dedicated to explaining classes or methods
Five, VS shortcut keys
5.1 Quick alignment
CTRL+K, only release K, quickly press D
5.2 Quick Smart Tips
Ctrl+J
5.3 Row operations
ctrl+home: start of line
ctrl+end: line tail
shift+home: After the cursor is at the end of the line, press the shortcut key to select the entire line
5.4 Uncomment
5.5 Code folding
# region
#endregion
namespace lesson01 //项目名称
{
class Program //类
{
/// <summary>
/// 随便注释下
/// </summary>
/// <param name="args"></param>
static void Main(string[] args) //main函数又叫main方法,程序的主入口,起始于main,结束于main
{
Console.WriteLine("第一个C#程序");
Console.WriteLine("第一个C#程序");
#region
Console.WriteLine("第一个C#程序");
Console.WriteLine("第一个C#程序");
#endregion
Console.ReadKey();
}
}
}
5.6 Other
Save: ctrl + S
Cancel: ctrl + Z