Rerfactor package parsing.

This commit is contained in:
Christian Kratky
2018-06-06 21:28:39 +02:00
parent b05cb0d2ea
commit c8bf36044b
13 changed files with 177 additions and 156 deletions
@@ -0,0 +1,20 @@
using System;
namespace MQTTnet.Serializer
{
public static class Extensions
{
public static byte[] ToArray(this ArraySegment<byte> source)
{
if (source.Array == null)
{
return null;
}
var buffer = new byte[source.Count];
Buffer.BlockCopy(source.Array, source.Offset, buffer, 0, buffer.Length);
return buffer;
}
}
}