public byte[] EncodeBe()
{
if (Value < 253)
{
return new[] {(byte) Value};
}
if (Value <= ushort.MaxValue)
{
return new[] {(byte) 253, (byte) Value, (byte) (Value >> 8)};
}
if (Value <= uint.MaxValue)
{
var bytes = new byte[5];
bytes[0] = 254;
Utils.Uint32ToByteArrayLe((uint) Value, bytes, 1);
return bytes;
}
else
{
var bytes = new byte[9];
bytes[0] = 255;
Utils.Uint32ToByteArrayLe((uint) Value, bytes, 1);
Utils.Uint32ToByteArrayLe((uint) (Value >> 32), bytes, 5);
return bytes;
}
}