예제 #1
0
        /// <summary>Returns the number of bytes in the specified array.</summary>
        /// <returns>The number of bytes in the array.</returns>
        /// <param name="array">An array. </param>
        /// <exception cref="T:System.ArgumentNullException">
        ///   <paramref name="array" /> is null. </exception>
        /// <exception cref="T:System.ArgumentException">
        ///   <paramref name="array" /> is not a primitive. </exception>
        /// <filterpriority>1</filterpriority>
        public static int ByteLength(Array array)
        {
            if (array == null)
            {
                throw new ArgumentNullException("array");
            }
            int num = Buffer.ByteLengthInternal(array);

            if (num < 0)
            {
                throw new ArgumentException(Locale.GetText("Object must be an array of primitives."));
            }
            return(num);
        }