C#又是我们接触的一门新的编程语言,从头开始学,(不能在像VB上吃亏了,VB是我的第一个墙门砖)目前感觉C#趣味多多
数据类型
| ||
数据类型 | 变量名称 | 赋值 |
Int | 整数 | 3 5 100 -10
|
Double | 小数 | 3.15 10.5 -3.14 -.5.0
|
Char | 字符 | ' A' 'b' 'c' ' '
|
String | 字符串 | "Zhangsan" "李四" "计算机" "HelloWord" "a"
|
Decimal | 金钱小数 | Decimal (money) 5.52m
|
注: 1.字符不能为空,最少是一个,最多也是一个
2.字符串 可以为空,可以为多个
3.金钱小数 Decimal money=25.55m 与 小数 Double douNumber=30.5的区别,看清楚了哈
代码展示一下呦
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace _06_各种数据类型
{
class Program
{
static void Main(string[] args)
{
int num = 100;//存整数
double dounumber = 30.5;//存小数
//字符不能为空,最少是一个,最多也是一个
char ch='5';//字符类型 存字符
//字符串 可以为空,可以为多个
string str = "I Will can";
//精度的问题
decimal money = 25.5m;
}
}
}
对了C#里告诉了一些新的快捷键的使用,比如:
Ctrl + C + K 快速注释 (前提是你选中所要注释的内容)
Shift + Delete 彻底删除
F6 生成解决方案
F12 转到定义
.......
【总结】总结自己该总结的,学习自己该学习的,保持一颗好奇心,细心滴走下去~