FromArraySegment() public static method

public static FromArraySegment ( ArraySegment data ) : TcpPackage
data ArraySegment
return TcpPackage
        private void OnMessageArrived(ArraySegment <byte> data)
        {
            TcpPackage package;

            try {
                package = TcpPackage.FromArraySegment(data);
            } catch (Exception e) {
                SendBadRequestAndClose(Guid.Empty, string.Format("Received bad network package. Error: {0}", e));
                return;
            }

            OnPackageReceived(package);
        }
        private void OnMessageArrived(ArraySegment <byte> data)
        {
            TcpPackage package;

            try
            {
                package = TcpPackage.FromArraySegment(data);
            }
            catch (Exception e)
            {
                Log.InfoException(e, "Received bad network package");
                SendPackage(new TcpPackage(TcpCommand.BadRequest, Guid.Empty, null));
                Stop();
                return;
            }

            OnPackageReceived(package);
        }
        private void OnMessageArrived(ArraySegment <byte> data)
        {
            var package = TcpPackage.FromArraySegment(data);

            OnPackageReceived(package);
        }