You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

21 rivejä
445 B

  1. using System;
  2. namespace MQTTnet.Serializer
  3. {
  4. public static class Extensions
  5. {
  6. public static byte[] ToArray(this ArraySegment<byte> source)
  7. {
  8. if (source.Array == null)
  9. {
  10. return null;
  11. }
  12. var buffer = new byte[source.Count];
  13. Buffer.BlockCopy(source.Array, source.Offset, buffer, 0, buffer.Length);
  14. return buffer;
  15. }
  16. }
  17. }