Int16 to byte array

I’m trying to convert a int16 to a byte array but i cant seem to get it to work.
Here is what i’ve got right now:

int16 i := 41
a := []byte(string(i))//this line is wrong

Also if someone wonder the array needs to be a length of 2.

byte[] bytes = BitConverter.GetBytes(i);

although note also that you might want to check BitConverter.IsLittleEndian to see which way around that is going to appear!

Note that if you are doing this repeatedly you might want to avoid all those short-lived array allocations by writing it yourself via either shift operations (>> / <<), or by using unsafe code. Shift operations also have the advantage that they aren't affected by your platform's endianness; you always get the bytes in the order you expect them.