终于装好了VS2013,开始!(一)

  VS下载安装速度之慢我已不想吐槽,正式开始吧!

1. 新建一个项目:

2. 选择模板:Visual C# --> 控制台应用程序,还可以为自己的项目重新命名、设定储存位置。

3. 模板出来啦!

 1 using System;
 2 using System.Collections.Generic;
 3 using System.Linq;
 4 using System.Text;
 5 using System.Threading.Tasks;
 6 
 7 namespace HelloWorld
 8 {
 9     class Program
10     {
11         static void Main(string[] args)
12         {
13         }
14     }
15 }

4. 加上输出"Hello World!"的语句,并加上一句话使控制台在桌面上停留。

 1 using System;
 2 using System.Collections.Generic;
 3 using System.Linq;
 4 using System.Text;
 5 using System.Threading.Tasks;
 6 
 7 namespace HelloWorld
 8 {
 9     class Program
10     {
11         static void Main(string[] args)
12         {
13             System.Console.WriteLine("Hello World!");   // output "Hello World!".
14             Console.ReadLine();     // prevent the Console from disappearing immediately.
15         }
16     }
17 }

5. 点击运行

6. 成功运行!

简单的拓展一:加入几个语句调节控制台输出。

 1 using System;
 2 using System.Collections.Generic;
 3 using System.Linq;
 4 using System.Text;
 5 using System.Threading.Tasks;
 6 
 7 namespace HelloWorld
 8 {
 9     class Program
10     {
11         static void Main(string[] args)
12         {
13             Console.Title = "My Title"; // set the title of the Console.
14             Console.ForegroundColor = ConsoleColor.Red; // set the color of words into Red.
15             Console.BackgroundColor = ConsoleColor.Yellow; // set the background color into Red.
16 
17             Console.WriteLine("Hello World!");   // output "Hello World!".
18             Console.ReadLine();     // prevent the Console from disappearing immediately.
19         }
20     }
21 }

现在的效果:

原文地址:https://www.cnblogs.com/yongheng20/p/4342619.html