Literal improvements
When it comes to literals, we can think about the declaration of various variables constant, which are sometimes the life of a method as these would be very important for a method or to take any decision. And it leads to wrong decisions with the misreading of a numeric constant. To overcome this confusion, C# 7.0 introduced two new features, binary literals and digit separators.
Binary literals
Binary digits are very important for performing complex operations. A constant of a binary digit can be declared as 0b<binaryvalue>, where 0b tells us that this is a binary literal and binary values is the value of your decimal digit. Here are a few examples:
//Binary literals public const int Nineteen = 0b00010011; public const int Ten = 0b00001010; public const int Four = 0b0100; public const int Eight = 0b1000;
Digit separator
With the introduction of digit separators, we can easily read long numeric, binary digits. Digit separators can be used with both numeric and binary...