static void EncodeTypeAndLength (byte[] buf, ref int index, short type, short length) { buf[index++] = (byte) (type); buf[index++] = (byte) (type >> 8); buf[index++] = (byte) (length); buf[index++] = (byte) (length >> 8); }