C#(1):各类应用程序

一个解决方案下有多个项目时需要右键将该项目设置为默认启动方案


console程序:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
///控制台project
namespace ConsoleHelloWorld
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("HelloWorld");
        }
    }
}


WinForm:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace WinFormHelloWorld
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {

        }

        private void button1_Click(object sender, EventArgs e)
        {
            textBoxShowHello.Text = "HelloWorld";
        }
    }
}


WpfHelloWorld

wpf可以使用类似html的界面设计

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
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>
    /// MainWindow.xaml 的交互逻辑
    /// </summary>
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();
        }

        private void textBoxShowHello_TextChanged(object sender, TextChangedEventArgs e)
        {

        }

        private void buttonSayHello_Click(object sender, RoutedEventArgs e)
        {
            textBoxShowHello.Text = "hello World";
        }
    }
}

ASP.NET Web Forms

发布网站


ASP.NET MVC

类似webforms的一种新的系统架构网站


 

 

posted @ 2023-09-08 10:44  HY10-SALTEST-FISH  阅读(8)  评论(0编辑  收藏  举报