Literal suffix for byte in .NET?

There is no mention of a literal suffix on the MSDN reference for Byte as well as in the C# 4.0 Language Specification. The only literal suffixes in C# are for integer and real numbers as follows:

u = uint
l = long
ul = ulong
f = float
m = decimal
d = double

If you want to use var, you can always cast the byte as in var y = (byte) 5

Although not really related, in C#7, a new binary prefix was introduced 0b, which states the number is in binary format. Still there is no suffix to make it a byte though, example:

var b = 0b1010_1011_1100_1101_1110_1111; //int

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)