# C1.Util.DX.DataStream.WriteRange

## Content

<div class="doc-site-dotnet-api-container">



<h1 id="C1_Util_DX_DataStream_WriteRange_" data-uid="C1.Util.DX.DataStream.WriteRange*">WriteRange Method
</h1>
<div class="markdown level0 summary"></div>
<div class="markdown level0 conceptual"></div>



<a id="C1_Util_DX_DataStream_WriteRange_" data-uid="C1.Util.DX.DataStream.WriteRange*"></a>
<h4 id="C1_Util_DX_DataStream_WriteRange__1___0___" data-uid="C1.Util.DX.DataStream.WriteRange``1(``0[])">WriteRange&lt;T&gt;(T[])</h4>
<div class="markdown level1 summary"><p>Writes an array of values to the current stream, and advances the current position
within this stream by the number of bytes written.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">public void WriteRange&lt;T&gt;(T[] data) where T : struct</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Public Sub WriteRange(Of T As Structure)(data As T())</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">data</span></td>
      <td><p>An array of values to be written to the current stream.</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></td>
    </tr>
  </tbody>
</table>
<h5 id="C1_Util_DX_DataStream_WriteRange__1___0____remarks">Remarks</h5>
<div class="markdown level1 remarks"><p>In order to provide faster read/write, this operation doesn't check stream bound.
A client must carefully not read/write above the size of this datastream.</p>
</div>
<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.notsupportedexception">NotSupportedException</a></td>
      <td><p>This stream does not support writing.</p>
</td>
    </tr>
  </tbody>
</table>


<a id="C1_Util_DX_DataStream_WriteRange_" data-uid="C1.Util.DX.DataStream.WriteRange*"></a>
<h4 id="C1_Util_DX_DataStream_WriteRange_System_IntPtr_System_Int64_" data-uid="C1.Util.DX.DataStream.WriteRange(System.IntPtr,System.Int64)">WriteRange(IntPtr, long)</h4>
<div class="markdown level1 summary"><p>Writes a range of bytes to the current stream, and advances the current position
within this stream by the number of bytes written.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">public void WriteRange(IntPtr source, long count)</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Public Sub WriteRange(source As IntPtr, count As Long)</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><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.intptr">IntPtr</a></td>
      <td><span class="parametername">source</span></td>
      <td><p>A pointer to the location to start copying from.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.int64">long</a></td>
      <td><span class="parametername">count</span></td>
      <td><p>The number of bytes to copy from source to the current stream.</p>
</td>
    </tr>
  </tbody>
</table>
<h5 id="C1_Util_DX_DataStream_WriteRange_System_IntPtr_System_Int64__remarks">Remarks</h5>
<div class="markdown level1 remarks"><p>In order to provide faster read/write, this operation doesn't check stream bound.
A client must carefully not read/write above the size of this datastream.</p>
</div>
<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.notsupportedexception">NotSupportedException</a></td>
      <td><p>This stream does not support writing.</p>
</td>
    </tr>
  </tbody>
</table>


<a id="C1_Util_DX_DataStream_WriteRange_" data-uid="C1.Util.DX.DataStream.WriteRange*"></a>
<h4 id="C1_Util_DX_DataStream_WriteRange__1___0___System_Int32_System_Int32_" data-uid="C1.Util.DX.DataStream.WriteRange``1(``0[],System.Int32,System.Int32)">WriteRange&lt;T&gt;(T[], int, int)</h4>
<div class="markdown level1 summary"><p>Writes an array of values to the current stream, and advances the current position
within this stream by the number of bytes written.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">public void WriteRange&lt;T&gt;(T[] data, int offset, int count) where T : struct</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Public Sub WriteRange(Of T As Structure)(data 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">data</span></td>
      <td><p>An array of values to be written to the stream.</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 zero-based offset in data at which to begin copying values to the current stream.</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 values to be written to the current stream. If this is zero,
all of the contents <code class="paramref">data</code> will be written.</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>The type of the values to be written to the stream.</p>
</td>
    </tr>
  </tbody>
</table>
<h5 id="C1_Util_DX_DataStream_WriteRange__1___0___System_Int32_System_Int32__remarks">Remarks</h5>
<div class="markdown level1 remarks"><p>In order to provide faster read/write, this operation doesn't check stream bound.
A client must carefully not read/write above the size of this datastream.</p>
</div>
<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.notsupportedexception">NotSupportedException</a></td>
      <td><p>This stream does not support writing.</p>
</td>
    </tr>
  </tbody>
</table>
</div>
