# C1.Util.DX.Vector2.-ctor

## Content

<div class="doc-site-dotnet-api-container">



<h1 id="C1_Util_DX_Vector2__ctor_" data-uid="C1.Util.DX.Vector2.#ctor*">Vector2 Constructor
</h1>
<div class="markdown level0 summary"></div>
<div class="markdown level0 conceptual"></div>



<a id="C1_Util_DX_Vector2__ctor_" data-uid="C1.Util.DX.Vector2.#ctor*"></a>
<h4 id="C1_Util_DX_Vector2__ctor_System_Single_" data-uid="C1.Util.DX.Vector2.#ctor(System.Single)">Vector2(float)</h4>
<div class="markdown level1 summary"><p>Initializes a new instance of the <a class="xref" href="C1.Util.DX.Vector2.html">Vector2</a> struct.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">public Vector2(float value)</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Public Sub New(value As Single)</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.single">float</a></td>
      <td><span class="parametername">value</span></td>
      <td><p>The value that will be assigned to all components.</p>
</td>
    </tr>
  </tbody>
</table>


<a id="C1_Util_DX_Vector2__ctor_" data-uid="C1.Util.DX.Vector2.#ctor*"></a>
<h4 id="C1_Util_DX_Vector2__ctor_System_Single_System_Single_" data-uid="C1.Util.DX.Vector2.#ctor(System.Single,System.Single)">Vector2(float, float)</h4>
<div class="markdown level1 summary"><p>Initializes a new instance of the <a class="xref" href="C1.Util.DX.Vector2.html">Vector2</a> struct.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">public Vector2(float x, float y)</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Public Sub New(x As Single, y As Single)</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.single">float</a></td>
      <td><span class="parametername">x</span></td>
      <td><p>Initial value for the X component of the vector.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.single">float</a></td>
      <td><span class="parametername">y</span></td>
      <td><p>Initial value for the Y component of the vector.</p>
</td>
    </tr>
  </tbody>
</table>


<a id="C1_Util_DX_Vector2__ctor_" data-uid="C1.Util.DX.Vector2.#ctor*"></a>
<h4 id="C1_Util_DX_Vector2__ctor_System_Single___" data-uid="C1.Util.DX.Vector2.#ctor(System.Single[])">Vector2(float[])</h4>
<div class="markdown level1 summary"><p>Initializes a new instance of the <a class="xref" href="C1.Util.DX.Vector2.html">Vector2</a> struct.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">public Vector2(float[] values)</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Public Sub New(values As Single())</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.single">float</a>[]</td>
      <td><span class="parametername">values</span></td>
      <td><p>The values to assign to the X and Y components of the vector. This must be an array with two elements.</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>Thrown when <code class="paramref">values</code> is <code>null</code>.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.argumentoutofrangeexception">ArgumentOutOfRangeException</a></td>
      <td><p>Thrown when <code class="paramref">values</code> contains more or less than two elements.</p>
</td>
    </tr>
  </tbody>
</table>
</div>
