Microsoft.Protocols.TestSuites.SharedAdapter.LittleEndianBitConverter.CheckByteArgument C# (CSharp) Method

CheckByteArgument() private static method

This method is used to check the given argument for validity.
The byte array is a null reference. /// StartIndex is greater than the length of value minus bytesRequired. /// /// StartIndex is less than zero. ///
private static CheckByteArgument ( byte value, int startIndex, int bytesRequired ) : void
value byte Specify the byte array.
startIndex int Specify the start index.
bytesRequired int Specify the number of bytes.
return void
        private static void CheckByteArgument(byte[] value, int startIndex, int bytesRequired)
        {
            if (value == null)
            {
                throw new ArgumentNullException("value");
            }

            if (startIndex < 0)
            {
                throw new ArgumentException("The index cannot be less than 0.");
            }

            if (startIndex > value.Length - bytesRequired)
            {
                throw new ArgumentOutOfRangeException("startIndex");
            }
        }
    }