# C1.Util.DX.DataPointer.CopyTo

## Content

<div class="doc-site-dotnet-api-container">



<h1 id="C1_Util_DX_DataPointer_CopyTo_" data-uid="C1.Util.DX.DataPointer.CopyTo*">CopyTo Method
</h1>
<div class="markdown level0 summary"></div>
<div class="markdown level0 conceptual"></div>



<a id="C1_Util_DX_DataPointer_CopyTo_" data-uid="C1.Util.DX.DataPointer.CopyTo*"></a>
<h4 id="C1_Util_DX_DataPointer_CopyTo__1___0___System_Int32_System_Int32_" data-uid="C1.Util.DX.DataPointer.CopyTo``1(``0[],System.Int32,System.Int32)">CopyTo&lt;T&gt;(T[], int, int)</h4>
<div class="markdown level1 summary"><p>Reads the content of the unmanaged memory location of this instance to the specified buffer.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">public void CopyTo&lt;T&gt;(T[] buffer, int offset, int count) where T : struct</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Public Sub CopyTo(Of T As Structure)(buffer As T(), offset As Integer, count As Integer)</code></pre>
</div>
<h5 class="parameters">Parameters</h5>
<table class="table table-bordered table-condensed">
  <thead>
    <tr>
      <th>Type</th>
      <th>Name</th>
      <th>Description</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>T[]</td>
      <td><span class="parametername">buffer</span></td>
      <td><p>The buffer.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.int32">int</a></td>
      <td><span class="parametername">offset</span></td>
      <td><p>The offset in the array to write to.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.int32">int</a></td>
      <td><span class="parametername">count</span></td>
      <td><p>The number of T element to read from the memory location.</p>
</td>
    </tr>
  </tbody>
</table>
<h5 class="typeParameters">Type Parameters</h5>
<table class="table table-bordered table-condensed">
  <thead>
    <tr>
      <th>Name</th>
      <th>Description</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td><span class="parametername">T</span></td>
      <td><p>Type of a buffer element</p>
</td>
    </tr>
  </tbody>
</table>
<h5 class="exceptions">Exceptions</h5>
<table class="table table-bordered table-condensed">
  <thead>
    <tr>
      <th>Type</th>
      <th>Condition</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.argumentnullexception">ArgumentNullException</a></td>
      <td><p>buffer</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.invalidoperationexception">InvalidOperationException</a></td>
      <td><p>DataPointer is Zero</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.argumentoutofrangeexception">ArgumentOutOfRangeException</a></td>
      <td><p>buffer;Total buffer size cannot be larger than size of this data pointer</p>
</td>
    </tr>
  </tbody>
</table>
</div>
