首页 技术 正文
技术 2022年11月12日
0 收藏 451 点赞 3,852 浏览 693 个字

1、out关键字

//可以直接声明使用
int.TryParse("",out int number);

2、元组

//有点类似匿名对象的样子
//用小括号包含变量,可以当做返回值,可以当做变量赋值等//1.当做函数的返回值
public static (string name, int age) GetStu() => ("张三",);

public static (string name, int age) GetStu() => (name:"张三",age:);//2.直接赋值
(string name, int age) = GetStu();
Console.WriteLine($"{name}+{age}");

var result = GetStu();
Console.WriteLine($"{result.name}+{result.age}");

(string name2, int age2) = ("lisi",);
Console.WriteLine($"{name2}+{age2}");

3、可以在函数中创建本地函数

static void Main(string[] args) {
//在main函数中创建了一个WriteLine函数
void WriteLine(string msg) {
Console.Write(msg);
} WriteLine("hello");
Console.ReadKey();
}

4、数字分隔符

//二进制字面量以0b开头
int eight = 0b1000_0000;//128
//数字分隔符以_代表
double pi = .1415_926;//3.1415926
long cardId=621_532_9653_342;//
相关推荐
python开发_常用的python模块及安装方法
adodb:我们领导推荐的数据库连接组件bsddb3:BerkeleyDB的连接组件Cheetah-1.0:我比较喜欢这个版本的cheeta…
日期:2022-11-24 点赞:878 阅读:8,951
Educational Codeforces Round 11 C. Hard Process 二分
C. Hard Process题目连接:http://www.codeforces.com/contest/660/problem/CDes…
日期:2022-11-24 点赞:807 阅读:5,477
下载Ubuntn 17.04 内核源代码
zengkefu@server1:/usr/src$ uname -aLinux server1 4.10.0-19-generic #21…
日期:2022-11-24 点赞:569 阅读:6,290
可用Active Desktop Calendar V7.86 注册码序列号
可用Active Desktop Calendar V7.86 注册码序列号Name: www.greendown.cn Code: &nb…
日期:2022-11-24 点赞:733 阅读:6,107
Android调用系统相机、自定义相机、处理大图片
Android调用系统相机和自定义相机实例本博文主要是介绍了android上使用相机进行拍照并显示的两种方式,并且由于涉及到要把拍到的照片显…
日期:2022-11-24 点赞:512 阅读:7,739
Struts的使用
一、Struts2的获取  Struts的官方网站为:http://struts.apache.org/  下载完Struts2的jar包,…
日期:2022-11-24 点赞:671 阅读:4,773