/// <summary> /// Writes the given value to the buffer using the given endianity and increments the offset by the number of bytes written. /// </summary> /// <param name="buffer">The buffer to write the value to.</param> /// <param name="offset">The offset in the buffer to start writing.</param> /// <param name="value">The value to write.</param> /// <param name="endianity">The endianity to use when converting the value to bytes.</param> public static void Write(this byte[] buffer, ref int offset, MacAddress value, Endianity endianity) { buffer.Write(ref offset, value.ToValue(), endianity); }
public static ReadOnlyCollection<byte> MacAddressToBytes(MacAddress macAddress) { return Array.AsReadOnly(BitConverter.GetBytes(macAddress.ToValue()).Reverse().Skip(2).ToArray()); }