共用方式為


VertexBuffer.SetData Generic Method (T , Int32, Int32)

Sets vertex buffer data, specifying the start index and number of elements.

Syntax

'Declaration
Public Sub SetData(Of T As ValueType) ( _
         data As T(), _
         startIndex As Integer, _
         elementCount As Integer _
)
public void SetData<T> (
         T[] data,
         int startIndex,
         int elementCount
) where T : ValueType
public:
generic<typename T> where T : ValueType
void SetData(
         T data[],
         int startIndex,
         int elementCount
)

Type Parameters

  • T
    The type of the elements in the array.

Parameters

  • data
    Type: T
    Array of data.
  • startIndex
    Type: Int32
    Index of the first element to set.
  • elementCount
    Type: Int32
    Number of elements to set.

Exceptions

Exception type Condition
ArgumentNullException data is null.
ArgumentOutOfRangeException One of the following conditions is true:
  • The vertex stride is larger than the vertex buffer.
  • The vertex stride is too small for the type of data requested.
InvalidOperationException The array is not the correct size for the amount of data requested.

Remarks

An InvalidOperationException is thrown if an attempt is made to modify (for example, calls to the SetData method) a resource that is currently set on a graphics device.

Requirements

Namespace: Microsoft.Xna.Framework.Graphics

Assembly: Microsoft.Xna.Framework.Graphics (in microsoft.xna.framework.graphics.dll)

See Also

Reference

VertexBuffer Class
VertexBuffer Members
Microsoft.Xna.Framework.Graphics Namespace

Platforms

Windows Phone