public UInt16[] ToUInt16Array()
{
//Get the Half size of the Packet
int checksumBufferLength = (int)Math.Ceiling((double)ICMP_PACKET_SIZE / 2);
//Create byte array
byte[] buffer = this.ToByteArray();
if (buffer == null)
return null;
//Create a UInt16 Array
UInt16[] checksumBuffer = new UInt16[checksumBufferLength];
//Code to initialize the Uint16 array
int icmpHeaderBufferIndex = 0;
for (int i = 0; i < checksumBufferLength; i++)
{
checksumBuffer[i] = BitConverter.ToUInt16(buffer, icmpHeaderBufferIndex);
icmpHeaderBufferIndex += 2;
}
return checksumBuffer;
}