# GrapeCity.Documents.Common.Unit.TryParse

## Content

<div class="doc-site-dotnet-api-container">



<h1 id="GrapeCity_Documents_Common_Unit_TryParse_" data-uid="GrapeCity.Documents.Common.Unit.TryParse*">TryParse Method
</h1>
<div class="markdown level0 summary"></div>
<div class="markdown level0 conceptual"></div>



<a id="GrapeCity_Documents_Common_Unit_TryParse_" data-uid="GrapeCity.Documents.Common.Unit.TryParse*"></a>
<h4 id="GrapeCity_Documents_Common_Unit_TryParse_System_String_System_Single__GrapeCity_Documents_Common_UnitTypeEnum__" data-uid="GrapeCity.Documents.Common.Unit.TryParse(System.String,System.Single@,GrapeCity.Documents.Common.UnitTypeEnum@)">TryParse(string, out float, out UnitTypeEnum)</h4>
<div class="markdown level1 summary"><p>Parses a string and gets <a class="xref" href="GrapeCity.Documents.Common.Unit.Value.html#GrapeCity_Documents_Common_Unit_Value">Value</a> and <a class="xref" href="GrapeCity.Documents.Common.Unit.Units.html#GrapeCity_Documents_Common_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 float 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 Single, 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.single">float</a></td>
      <td><span class="parametername">value</span></td>
      <td><p>OUT: value of <a class="xref" href="GrapeCity.Documents.Common.Unit.html">Unit</a> structure.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="GrapeCity.Documents.Common.UnitTypeEnum.html">UnitTypeEnum</a></td>
      <td><span class="parametername">units</span></td>
      <td><p>OUT: units of <a class="xref" href="GrapeCity.Documents.Common.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="GrapeCity_Documents_Common_Unit_TryParse_" data-uid="GrapeCity.Documents.Common.Unit.TryParse*"></a>
<h4 id="GrapeCity_Documents_Common_Unit_TryParse_System_String_GrapeCity_Documents_Common_Unit__" data-uid="GrapeCity.Documents.Common.Unit.TryParse(System.String,GrapeCity.Documents.Common.Unit@)">TryParse(string, out Unit)</h4>
<div class="markdown level1 summary"><p>Parses a string and creates <a class="xref" href="GrapeCity.Documents.Common.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="GrapeCity.Documents.Common.Unit.html">Unit</a></td>
      <td><span class="parametername">unit</span></td>
      <td><p>OUT: <a class="xref" href="GrapeCity.Documents.Common.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>
