c# - Why does the new feature "binary literals" start with 0b instead of being suffixed? -


the next c# version planned (april 2014) have binary literals can see in language features status of roslyn project.

the example in page this:

0b00000100 

so use this:

var mybynaryliteral = 0b00000100; 

i want understand why choose prefix 0b instead of use letter in end did double, float, decimal , on.

double = 1d; float b = 1f; decimal c = 1m; 

integer literals possess 2 varying properties: types, can specified suffixes l or ul, , radices (called "forms" in documentation), can specified prefixes 0x , 0b.

specifying type done through suffix, , specifying radix done through prefix, makes sense keep same convention. in addition, can combine both specifiers.

for instance:

0b00101010ul 

would denote literal 42, stored unsigned long, , expressed in radix 2.


Comments

Popular posts from this blog

java - Intellij Synchronizing output directories .. -

git - Initial Commit: "fatal: could not create leading directories of ..." -