/// <summary> /// Creates a <see cref="D3D11BufferDesc"/> struct from a struct. /// </summary> /// <typeparam name="T">A struct.</typeparam> /// <param name="data">The data.</param> /// <param name="bindOptions">Identify how the buffer will be bound to the pipeline.</param> /// <param name="usage">Identify how the buffer is expected to be read from and written to.</param> /// <returns>A <see cref="D3D11BufferDesc"/> struct.</returns> public static D3D11BufferDesc From <T>(T[] data, D3D11BindOptions bindOptions, D3D11Usage usage) where T : struct { if (data == null) { throw new ArgumentNullException("data"); } return(new D3D11BufferDesc((uint)Marshal.SizeOf(typeof(T)) * (uint)data.Length, bindOptions, usage)); }