编程学习的捷径
●编程不是“学”出来的,而是“练”出来的
●在反复应用中积累,忽然有一天就会“顿悟”
●学习原则
●从感观到原理
●从使用别人的到创建自己的
●必须亲自动手
●必须学以致用,紧跟实际工作
●追求使用,不搞“学院派”
第一个程序:Hello,World!

Visual Studio在管理代码时,Solution(解决方案)是最高的级别。一个Solution里面可以包含一个或者多个Project。
前三样必须掌握!!!
● Console(控制台)
没有界面,只有命令进行交互。
using System;namespace ConsoleHelloWorld{class Program{static void Main(string[] args){Console.WriteLine("Hello World!");}}}
●Windows Forms(Old)(Window窗体应用)
没有Toolbox(工具箱)可以在View(视图)下打开。
拖拽Textbox和Button组件,修改其属性(此处分别修改名字TextboxShowHello、ButtonSayHello)
此处闪电符号即是“事件”。双击按钮/事件即可自动生成方法(如下)。
using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;using System.Threading.Tasks;using System.Windows.Forms;namespace WinFormsHelloWorld{public partial class Form1 : Form{public Form1(){InitializeComponent();}private void buttonSayHello_Click(object sender, EventArgs e){textBoxShowHello.Text = "He;llo,World!";}}}
● WPF(WPF应用程序)
以上Windows Forms的升级版。更加可视化便捷化。
依旧按照流程点击小闪电,然后添加方法。

using System.Linq;using System.Text;using System.Threading.Tasks;using System.Windows;using System.Windows.Controls;using System.Windows.Data;using System.Windows.Documents;using System.Windows.Input;using System.Windows.Media;using System.Windows.Media.Imaging;using System.Windows.Navigation;using System.Windows.Shapes;namespace WpfHelloWorld{/// <summary>/// Interaction logic for MainWindow.xaml/// </summary>public partial class MainWindow : Window{public MainWindow(){InitializeComponent();}private void ButtonSayHello(object sender, RoutedEventArgs e){TextBoxShowHello.Text = "Hello,world!";}}}
● ASP.NET Web Forms(Old)
创建空的Web Form。(现在有一个空的网站)
右键 > Add > Web Form
扩展名为aspx
●ASP.NET MVC (Model-View-Controller)
以上 ASP.NET Web Forms(Old)的升级版。MVC是程序员的架构。
依旧如上诉操作,Add > Controller > MVC Controller

此时如下图,右键函数 > Add View


●Windows Store Application(平板电脑)
●Windows Phone Application(手机)
●Cloud(Windows Azure)云计算
●WF(Workflow Foundation)
●WCF(Windows Commounication Foundation)


,和之前一样进行UI摆放和命名







