Commit a5884bdd authored by shargon's avatar shargon

Update DataSegment.cs

parent 7d204fb5
...@@ -23,15 +23,7 @@ namespace PcapDotNet.Packets ...@@ -23,15 +23,7 @@ namespace PcapDotNet.Packets
/// Take all the bytes as a segment. /// Take all the bytes as a segment.
/// </summary> /// </summary>
/// <param name="buffer">The buffer to take as a segment.</param> /// <param name="buffer">The buffer to take as a segment.</param>
public DataSegment(byte[] buffer) public DataSegment(byte[] buffer) : this(buffer, 0 , buffer==null ? 0 : buffer.Length) { }
{
if (buffer == null)
throw new ArgumentNullException("buffer");
Buffer = buffer;
StartOffset = 0;
Length = buffer.Length;
}
/// <summary> /// <summary>
/// Take only part of the bytes as a segment. /// Take only part of the bytes as a segment.
...@@ -41,6 +33,9 @@ namespace PcapDotNet.Packets ...@@ -41,6 +33,9 @@ namespace PcapDotNet.Packets
/// <param name="length">The number of bytes to take.</param> /// <param name="length">The number of bytes to take.</param>
public DataSegment(byte[] buffer, int offset, int length) public DataSegment(byte[] buffer, int offset, int length)
{ {
if (buffer == null)
throw new ArgumentNullException("buffer");
Buffer = buffer; Buffer = buffer;
StartOffset = offset; StartOffset = offset;
Length = length; Length = length;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment