C# 7.0 introduced two literal improvements, a digit separator and a hex literal.
Digit Separator
The digit separator “_” can be used inside number literals now. The purpose of a digit separator is to improve readability, nothing more. The value of the variable is unaffected by this literal.
The following code snippet shows how to use the digit separator.
The value of the above variables are 1000000 and ABCDEF.
Binary Literal
C# supports hexadecimal literals by using 0x. As Vulpes wrote in his article, Simulating binary literals in C#, the C# versions prior to C# 7.0 did not support binary literals.
Now, in C# 7.0, you can define binary literals using 0b. The following code snippet uses 0b and _ literals.
In this article, we learned about the literal improvements introduced in C# 7.0.
References used to write this article,