public FilePacketArray(FilePacketArray copyFrom) { Index = copyFrom.Index; Buffer = new byte[copyFrom.Buffer.Length]; System.Buffer.BlockCopy(copyFrom.Buffer, 0, Buffer, 0, copyFrom.FilledLength); FilledLength = copyFrom.FilledLength; }
public void CopyTo(FilePacketArray destination) { Debug.Assert(destination.Buffer != null, $"{nameof(destination)}.{nameof(destination.Buffer)} is null"); Debug.Assert(destination.Buffer.Length >= FilledLength, $"{nameof(destination)}.{nameof(destination.Buffer)} could not be less than source ${nameof(FilledLength)}"); destination.Index = Index; System.Buffer.BlockCopy(Buffer, 0, destination.Buffer, 0, FilledLength); destination.FilledLength = FilledLength; }