# C1.C1Preview.Utils.ConvertUnits

## Content

<div class="doc-site-dotnet-api-container">



<h1 id="C1_C1Preview_Utils_ConvertUnits_" data-uid="C1.C1Preview.Utils.ConvertUnits*">ConvertUnits Method
</h1>
<div class="markdown level0 summary"></div>
<div class="markdown level0 conceptual"></div>



<a id="C1_C1Preview_Utils_ConvertUnits_" data-uid="C1.C1Preview.Utils.ConvertUnits*"></a>
<h4 id="C1_C1Preview_Utils_ConvertUnits_System_Double_C1_C1Preview_UnitTypeEnum_C1_C1Preview_UnitTypeEnum_System_Single_System_Single_" data-uid="C1.C1Preview.Utils.ConvertUnits(System.Double,C1.C1Preview.UnitTypeEnum,C1.C1Preview.UnitTypeEnum,System.Single,System.Single)">ConvertUnits(double, UnitTypeEnum, UnitTypeEnum, float, float)</h4>
<div class="markdown level1 summary"><p>Converts a value from one unit of measurement to another.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">public static double ConvertUnits(double value, UnitTypeEnum from, UnitTypeEnum to, float fromDpi, float toDpi)</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Public Shared Function ConvertUnits(value As Double, from As UnitTypeEnum, [to] As UnitTypeEnum, fromDpi As Single, toDpi 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.double">double</a></td>
      <td><span class="parametername">value</span></td>
      <td><p>The value to convert.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="C1.C1Preview.UnitTypeEnum.html">UnitTypeEnum</a></td>
      <td><span class="parametername">from</span></td>
      <td><p>The source unit of measurement.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="C1.C1Preview.UnitTypeEnum.html">UnitTypeEnum</a></td>
      <td><span class="parametername">to</span></td>
      <td><p>The target unit of measurement.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.single">float</a></td>
      <td><span class="parametername">fromDpi</span></td>
      <td><p>The source DPI (used if <code class="paramref">from</code> is <a class="xref" href="C1.C1Preview.UnitTypeEnum.html#C1_C1Preview_UnitTypeEnum_Pixel">Pixel</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">toDpi</span></td>
      <td><p>The target DPI (used if <code class="paramref">to</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><code class="paramref">value</code> converted to <code class="paramref">to</code> units.</p>
</td>
    </tr>
  </tbody>
</table>
</div>
