当前位置:网站首页>C medium? This form of
C medium? This form of
2022-04-23 18:03:00 【OceanKeeper1215】
1. Nullable type modifier (?)
Citation type can use empty citation to indicate a non-existent value , The value type usually cannot be empty .
for example :stringstr=null; That's right. ,inti=null; The compiler will report an error .
To make the value type also nullable , You can use nullable types , Use the nullable type modifier "?" To show , The way of expression is "T?"
for example :int? Indicates nullable shaping ,DateTime? Indicates the time that can be empty .
T? It's actually System.Nullable( Generic structure ) The abbreviation of ,
That means when you use T? The compiler will compile T? Translate it into System.Nullable The way .
for example :int?, After compilation System.Nullable The way .
2. Three yuan ( Operator ) expression (?:)
for example :x?y:z Show that if the expression x by true, Then come back y;
If x by false, Then come back z, Is to omit if{}else{} In a simple way .
3. Null merge operator (??)
Default values used to define nullable types and citation types .
If the left operand of this operator is not null, Then this operator will return the left operand , Otherwise, the right operand .
for example :a??b When a by null When you come back b,a Not for null When you come back a Oneself .
The null merge operator is the right join operator , That is to say, it is combined from right to left during operation .
Such as ,“a??b??c” By the way of “a??(b??c)” Calculation .
4.NULL Look at the operator (?.)
版权声明
本文为[OceanKeeper1215]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204230545104864.html
边栏推荐
- Dock installation redis
- Calculation of fishing net road density
- word frequency count
- re正則錶達式
- Encapsulate a timestamp to date method on string prototype
- Selenium + phantom JS crack sliding verification 2
- QTableWidget使用讲解
- Re regular expression
- 2022 tea artist (primary) examination simulated 100 questions and simulated examination
- Timestamp to formatted date
猜你喜欢
C1小笔记【任务训练篇二】
C network related operations
idea中安装YapiUpload 插件将api接口上传到yapi文档上
Scikit learn sklearn 0.18 official document Chinese version
由tcl脚本生成板子对应的vivado工程
Summary of floating point double precision, single precision and half precision knowledge
Nat Commun|在生物科学领域应用深度学习的当前进展和开放挑战
k8s之实现redis一主多从动态扩缩容
Re expression régulière
Open source key component multi_ Button use, including test engineering
随机推荐
Using files to save data (C language)
mysql自动启动设置用Systemctl start mysqld启动
Realization of consumer gray scale
2022江西光伏展,中國分布式光伏展會,南昌太陽能利用展
_ FindText error
How to install jsonpath package
positioner
Re regular expression
.105Location
The method of changing a value in the array and a value in the object of wechat applet
Install pyshp Library
列錶的使用-增删改查
Build openstack platform
Flash operates on multiple databases
Logic regression principle and code implementation
Nat Commun|在生物科学领域应用深度学习的当前进展和开放挑战
开源按键组件Multi_Button的使用,含测试工程
idea中安装YapiUpload 插件将api接口上传到yapi文档上
解决允许在postman中写入注释请求接口方法
Eigen learning summary