#if (NETSTANDARD2_0 || NETSTANDARD1_6 || NETSTANDARD1_5 || NETSTANDARD1_4 || NETSTANDARD1_3 || NETSTANDARD1_2 || NETSTANDARD1_1 || NET45 || NET40 || NET451 || NET452 || NET46 || NET461 || NET462)
//------------------------------------------------------------------------------
// <auto-generated>
//     This code was generated by a tool.
//
//     Changes to this file may cause incorrect behavior and will be lost if
//     the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------

using System;
using System.Runtime.InteropServices;

namespace PRI.ProductivityExtensions.SafeBufferExtensions
{

	/// <summary>
	/// Class that contains extension methods that extend <seealso cref="System.Runtime.InteropServices.SafeBuffer">SafeBuffer</seealso>
	/// </summary>
	public static partial class SafeBufferable
	{
		/// <summary>
		/// Extends ReadArray&lt;T&gt; so that buffer offset of 0 and call to Array.Length are not needed.
		/// <example>
		/// safebuffer.ReadArray&lt;T&gt;(byteOffset, array);
		/// </example>
		/// </summary>
		public static void ReadArray<T>(this SafeBuffer safebuffer, UInt64 byteOffset, T[] array) where T : struct
		{
			if(safebuffer == null) throw new ArgumentNullException("safebuffer");

			if(array == null) throw new ArgumentNullException("array");

			safebuffer.ReadArray(byteOffset, array, 0, array.Length);
		}

		/// <summary>
		/// Extends WriteArray&lt;T&gt; so that buffer offset of 0 and call to Array.Length are not needed.
		/// <example>
		/// safebuffer.WriteArray&lt;T&gt;(byteOffset, array);
		/// </example>
		/// </summary>
		public static void WriteArray<T>(this SafeBuffer safebuffer, UInt64 byteOffset, T[] array) where T : struct
		{
			if(safebuffer == null) throw new ArgumentNullException("safebuffer");

			if(array == null) throw new ArgumentNullException("array");

			safebuffer.WriteArray(byteOffset, array, 0, array.Length);
		}

	}
}
#endif