I can guess what it does
You are right, it is the same as new byte[] { a, b }
I cannot find an explanation why the type definition byte[]
can be omitted
The reason it can be omitted is that both a
and b
are of type byte
. The compiler is smart enough to figure out that you meant to create an array of byte
s, so it does not ask you to specify the type explicitly.
Microsoft explains this shortcut here. The idea is similar to omitting the type in declarations that use var
, when the actual type can be inferred from initialization context.