# C1.C1Preview.Unit.ConvertUnit

## Content

<div class="doc-site-dotnet-api-container">



<h1 id="C1_C1Preview_Unit_ConvertUnit_" data-uid="C1.C1Preview.Unit.ConvertUnit*">ConvertUnit Method
</h1>
<div class="markdown level0 summary"></div>
<div class="markdown level0 conceptual"></div>



<a id="C1_C1Preview_Unit_ConvertUnit_" data-uid="C1.C1Preview.Unit.ConvertUnit*"></a>
<h4 id="C1_C1Preview_Unit_ConvertUnit_C1_C1Preview_UnitTypeEnum_" data-uid="C1.C1Preview.Unit.ConvertUnit(C1.C1Preview.UnitTypeEnum)">ConvertUnit(UnitTypeEnum)</h4>
<div class="markdown level1 summary"><p>Attempts to convert the current unit value to other unit of measurement.</p>
<p>Only absolute units can be converted.
This method throws an exception if the conversion cannot be performed.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">public double ConvertUnit(UnitTypeEnum destUnitType)</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Public Function ConvertUnit(destUnitType As UnitTypeEnum) As Double</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="C1.C1Preview.UnitTypeEnum.html">UnitTypeEnum</a></td>
      <td><span class="parametername">destUnitType</span></td>
      <td><p>The target <a class="xref" href="C1.C1Preview.UnitTypeEnum.html">UnitTypeEnum</a>.</p>
</td>
    </tr>
  </tbody>
</table>
<h5 class="returns">Returns</h5>
<table class="table table-bordered table-condensed">
  <thead>
    <tr>
      <th>Type</th>
      <th>Description</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.double">double</a></td>
      <td><p>The value in <code class="paramref">destUnitType</code> units.</p>
</td>
    </tr>
  </tbody>
</table>


<a id="C1_C1Preview_Unit_ConvertUnit_" data-uid="C1.C1Preview.Unit.ConvertUnit*"></a>
<h4 id="C1_C1Preview_Unit_ConvertUnit_C1_C1Preview_UnitTypeEnum_System_Single_" data-uid="C1.C1Preview.Unit.ConvertUnit(C1.C1Preview.UnitTypeEnum,System.Single)">ConvertUnit(UnitTypeEnum, float)</h4>
<div class="markdown level1 summary"><p>Attempts to convert the current unit value to other unit of measurement.</p>
<p>Only absolute units can be converted.
This method throws an exception if the conversion cannot be performed.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">public double ConvertUnit(UnitTypeEnum destUnitType, float destDpi)</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Public Function ConvertUnit(destUnitType As UnitTypeEnum, destDpi As Single) As Double</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="C1.C1Preview.UnitTypeEnum.html">UnitTypeEnum</a></td>
      <td><span class="parametername">destUnitType</span></td>
      <td><p>The target <a class="xref" href="C1.C1Preview.UnitTypeEnum.html">UnitTypeEnum</a>.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.single">float</a></td>
      <td><span class="parametername">destDpi</span></td>
      <td><p>The target resolution (used if <code class="paramref">destUnitType</code> is <a class="xref" href="C1.C1Preview.UnitTypeEnum.html#C1_C1Preview_UnitTypeEnum_Pixel">Pixel</a>).</p>
</td>
    </tr>
  </tbody>
</table>
<h5 class="returns">Returns</h5>
<table class="table table-bordered table-condensed">
  <thead>
    <tr>
      <th>Type</th>
      <th>Description</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.double">double</a></td>
      <td><p>The value in <code class="paramref">destUnitType</code> units.</p>
</td>
    </tr>
  </tbody>
</table>


<a id="C1_C1Preview_Unit_ConvertUnit_" data-uid="C1.C1Preview.Unit.ConvertUnit*"></a>
<h4 id="C1_C1Preview_Unit_ConvertUnit_System_Single_C1_C1Preview_UnitTypeEnum_System_Single_" data-uid="C1.C1Preview.Unit.ConvertUnit(System.Single,C1.C1Preview.UnitTypeEnum,System.Single)">ConvertUnit(float, UnitTypeEnum, float)</h4>
<div class="markdown level1 summary"><p>Attempts to convert the current unit value to other unit of measurement.</p>
<p>Only absolute units can be converted.
This method throws an exception if the conversion cannot be performed.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">public double ConvertUnit(float sourceDpi, UnitTypeEnum destUnitType, float destDpi)</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Public Function ConvertUnit(sourceDpi As Single, destUnitType As UnitTypeEnum, destDpi As Single) As Double</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">sourceDpi</span></td>
      <td><p>The current unit value's resolution (used if <a class="xref" href="C1.C1Preview.Unit.Units.html#C1_C1Preview_Unit_Units">Units</a> is <a class="xref" href="C1.C1Preview.UnitTypeEnum.html#C1_C1Preview_UnitTypeEnum_Pixel">Pixel</a>).</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="C1.C1Preview.UnitTypeEnum.html">UnitTypeEnum</a></td>
      <td><span class="parametername">destUnitType</span></td>
      <td><p>The target <a class="xref" href="C1.C1Preview.UnitTypeEnum.html">UnitTypeEnum</a>.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.single">float</a></td>
      <td><span class="parametername">destDpi</span></td>
      <td><p>The target resolution (used if <code class="paramref">destUnitType</code> is <a class="xref" href="C1.C1Preview.UnitTypeEnum.html#C1_C1Preview_UnitTypeEnum_Pixel">Pixel</a>).</p>
</td>
    </tr>
  </tbody>
</table>
<h5 class="returns">Returns</h5>
<table class="table table-bordered table-condensed">
  <thead>
    <tr>
      <th>Type</th>
      <th>Description</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.double">double</a></td>
      <td><p>The value in <code class="paramref">destUnitType</code> units.</p>
</td>
    </tr>
  </tbody>
</table>
</div>
