Can one of you fine C# experts decipher this for me?
new[] {(byte) (0x80 | byteArray.Length)}
I found this in same sample code, but have no idea what it is doing.
If someone could explain and/or re-write it in VB or Powershell that would be awesome.
I have googled for hours but my google-foo seems to be a little weak on this one.
For anyone that simply cannot get past the fact that this is ‘incomplete’ perhaps this snippet would suit you better…
new[] {(byte) (0x80 | 2 )}
>Solution :
This is an array initializer syntax in C#. You can check this question for all syntaxes. I infer that this is assigned to a variable of type byte[] – but your code is incomplete, so I can only make assumptions here.
In addition, the initializer explicitly adds the value of expression (byte) (0x80 | byteArray.Length) in the array. This is a bitwise OR operation between
0x80 in hex (128 in Decimal) and the length of the byteArray variable.
I do not know the purpose you are using this, but this it what it does in two sentences.