18 lines
501 B
Markdown
18 lines
501 B
Markdown
---
|
||
title: Literal Improvements
|
||
localeTitle: 文字改进
|
||
---
|
||
# 文字改进
|
||
|
||
C#7.0允许\_作为**_数字_**文字中的**_数字分隔符_**出现:
|
||
```
|
||
var d = 123_456;
|
||
var x = 0xAB_CD_EF;
|
||
```
|
||
|
||
您可以将它们放在数字之间的任何位置,以提高可读性。它们对价值没有影响。
|
||
|
||
此外,C#7.0引入了**_二进制文字_** ,因此您可以直接指定位模式,而不必心脏地知道十六进制表示法。
|
||
```
|
||
var b = 0b1010_1011_1100_1101_1110_1111;
|
||
|
||
``` |