Trusted answers to developer questions

Hammad Nasir

Interpreting numeric literals while reading can be cumbersome if the number is quite long (such as in the case of binary literals).

So, C# 7.0 introduces the concept of the **digit separator**, which improves readability.

Normally, a binary number is written as follows:

```
const int Eight = 0b00001000;
```

`0b`

denotes that the following digits represent a binary literal. Note that it takes a little focus to separate the

```
const int Eight = 0b0000_1000;
```

The `_`

present in the binary literal is called the *digit separator*. Now, it is fairly easy to interpret the binary string.

The digit separator can work on all numeric types. The following is an example:

```
const int Million = 1_000_000;
const int e = 2.718_281_828;
const int Pi = 3.141_592_654;
```

RELATED TAGS

c#

CONTRIBUTOR

Hammad Nasir

Copyright ©2022 Educative, Inc. All rights reserved

RELATED COURSES

View all Courses

Keep Exploring

Related Courses