# C1.Document.Unit.TryParse

## Content

<div class="doc-site-dotnet-api-container">



<h1 id="C1_Document_Unit_TryParse_" data-uid="C1.Document.Unit.TryParse*">TryParse Method
</h1>
<div class="markdown level0 summary"></div>
<div class="markdown level0 conceptual"></div>



<a id="C1_Document_Unit_TryParse_" data-uid="C1.Document.Unit.TryParse*"></a>
<h4 id="C1_Document_Unit_TryParse_System_String_System_Double__C1_Document_UnitTypeEnum__" data-uid="C1.Document.Unit.TryParse(System.String,System.Double@,C1.Document.UnitTypeEnum@)">TryParse(string, out double, out UnitTypeEnum)</h4>
<div class="markdown level1 summary"><p>Parses a string and gets <a class="xref" href="C1.Document.Unit.Value.html#C1_Document_Unit_Value">Value</a> and <a class="xref" href="C1.Document.Unit.Units.html#C1_Document_Unit_Units">Units</a> from that string.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">public static bool TryParse(string s, out double value, out UnitTypeEnum units)</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Public Shared Function TryParse(s As String, ByRef value As Double, ByRef units As UnitTypeEnum) As Boolean</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.string">string</a></td>
      <td><span class="parametername">s</span></td>
      <td><p>The string to parse.</p>
</td>
    </tr>
    <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>OUT: value of <a class="xref" href="C1.Document.Unit.html">Unit</a> structure.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="C1.Document.UnitTypeEnum.html">UnitTypeEnum</a></td>
      <td><span class="parametername">units</span></td>
      <td><p>OUT: units of <a class="xref" href="C1.Document.Unit.html">Unit</a> structure.</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.boolean">bool</a></td>
      <td><p>A <b>true</b> if conversion was successfull.</p>
</td>
    </tr>
  </tbody>
</table>


<a id="C1_Document_Unit_TryParse_" data-uid="C1.Document.Unit.TryParse*"></a>
<h4 id="C1_Document_Unit_TryParse_System_String_C1_Document_Unit__" data-uid="C1.Document.Unit.TryParse(System.String,C1.Document.Unit@)">TryParse(string, out Unit)</h4>
<div class="markdown level1 summary"><p>Parses a string and creates <a class="xref" href="C1.Document.Unit.html">Unit</a> structure.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">public static bool TryParse(string s, out Unit unit)</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Public Shared Function TryParse(s As String, ByRef unit As Unit) As Boolean</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.string">string</a></td>
      <td><span class="parametername">s</span></td>
      <td><p>The string to parse.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="C1.Document.Unit.html">Unit</a></td>
      <td><span class="parametername">unit</span></td>
      <td><p>OUT: <a class="xref" href="C1.Document.Unit.html">Unit</a> structure.</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.boolean">bool</a></td>
      <td><p>True if the conversion was successfull, false otherwise.</p>
</td>
    </tr>
  </tbody>
</table>
</div>
