mirror of
https://github.com/dotnet/MQTTnet.git
synced 2026-10-22 04:43:04 +08:00
Refactor namings of serializers etc.
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
using System;
|
||||
|
||||
namespace MQTTnet.Internal
|
||||
{
|
||||
public static class ArraySegmentExtensions
|
||||
{
|
||||
public static byte[] ToArray(this ArraySegment<byte> source)
|
||||
{
|
||||
if (source.Array == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
var buffer = new byte[source.Count];
|
||||
if (buffer.Length > 0)
|
||||
{
|
||||
Array.Copy(source.Array, source.Offset, buffer, 0, buffer.Length);
|
||||
}
|
||||
|
||||
return buffer;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user