unity-c#篇

C#语言基础(unity)

一、.NET简介:

dotnet:Microsoft新一代多语言的开发平台,用于构建和运行应用程序;
c#(sharp):Microsoft专为.NET推出的高级编程语言;
Mono:Novell公司支持在其他操作系统(Linux,iOS)下开发.NET程序的框架;(unity借助Mono实现跨平台,核心是.NET Framework框架)
下面展示一些 内联代码片

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

namespace ConsoleDay01
{
    class Programa
    {
        static void Main(string[] args)
        {
            Console.WriteLine("Hello,World!");
           string name= Console.ReadLine();
        }
    }
}

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

namespace ConsoleADay01
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("请输入姓名:");
            string name=Console.ReadLine();
            Console.WriteLine(name);
            Console.ReadLine();
        }
    }
}

(生成-exe-运行);
c#文件后缀名称:.cs;
WirteLine(将括号内容写入console);
ReadLine(将括号内容读到程序(name)中);
在console(控制台)显示括号内的内容;

二、
1.console是类(工具,后有.来调用属性和方法),WriteLine/ReadLine是方法(功能,后跟小括号),Title是属性(修饰);
类.方法(“”);类.属性=“”

2.class来定义类(做工具);
namespace定义命名空间(工具的存放地址):对类进行逻辑上的划分,避免重名;
using来引入命名空间如system下的console;

vs独立快捷键:

Ctrl + K +F自动对齐
Ctrl +K+C注释选中的代码
Ctrl+ K +U取消注释

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值