C#-Visual Studio 2017安装与使用

Visual Studio 2017

Visual Studio 2017 适用于开发Android、iOS、Windows、Web和云的应用,支持创建.NET Core程序。

安装Visual Studio 2017

  1. 从微软官网下载安装文件 visual_studio_professional_2017_x86_x64.exe。这只是一个引导程序(Web Installer)。
  • 若已下载visual studio 2017,但不确定是否安装所需组件(通用Windows平台开发、.NET桌面开发、ASP.NET和Web开发)时具体步骤如下:

    打开Visual Studio Installer→点开更多,选择修改→进入工作负载选择界面
    在这里插入图片描述

    创建项目

    文件→新建→项目

    相关文件介绍

    • .sln:解决方案文件
    • .csproj:项目文件
    • .cs:C#源码文件
    • bin:项目编译后的输出
    • obj:编译时产生的中间文件
    • AssemblyInfo.cs:程序本版、信息、版权的属性文件

    命名空间

    System.Console.WriteLine(“Hello World!”);
    使用 using System 后,上述语句变为 Console.WriteLine(“Hello World!”);

    快捷键

    F5 :运行
    F11:逐行执行

    案例分析与实现

    要求

    1. 显示 输入姓名;
    2. 接收用户输入的姓名;
    3. 控制台输出。

    关键

    • 显示:Console.WriteLine()
    • 接收用户输入:Console.ReadLine()

代码

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("please input your name:");
            string name = Console.ReadLine();
            Console.WriteLine("Hello  {0},welcome come to the world of C#", name);
            Console.ReadKey();    //wait for keyboard input,exit the program
        }
    }
}

运行结果
在这里插入图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值