# C1.Util.DX.Storage.NativeFile.ReadAllText

## Content

<div class="doc-site-dotnet-api-container">



<h1 id="C1_Util_DX_Storage_NativeFile_ReadAllText_" data-uid="C1.Util.DX.Storage.NativeFile.ReadAllText*">ReadAllText Method
</h1>
<div class="markdown level0 summary"></div>
<div class="markdown level0 conceptual"></div>



<a id="C1_Util_DX_Storage_NativeFile_ReadAllText_" data-uid="C1.Util.DX.Storage.NativeFile.ReadAllText*"></a>
<h4 id="C1_Util_DX_Storage_NativeFile_ReadAllText_System_String_" data-uid="C1.Util.DX.Storage.NativeFile.ReadAllText(System.String)">ReadAllText(string)</h4>
<div class="markdown level1 summary"><p>Opens a text file, reads all lines of the file, and then closes the file.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">public static string ReadAllText(string path)</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Public Shared Function ReadAllText(path As String) As String</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">path</span></td>
      <td><p>The file to open for reading.</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.string">string</a></td>
      <td><p>A string containing all lines of the file.</p>
</td>
    </tr>
  </tbody>
</table>


<a id="C1_Util_DX_Storage_NativeFile_ReadAllText_" data-uid="C1.Util.DX.Storage.NativeFile.ReadAllText*"></a>
<h4 id="C1_Util_DX_Storage_NativeFile_ReadAllText_System_String_System_Text_Encoding_C1_Util_DX_Storage_NativeFileShare_" data-uid="C1.Util.DX.Storage.NativeFile.ReadAllText(System.String,System.Text.Encoding,C1.Util.DX.Storage.NativeFileShare)">ReadAllText(string, Encoding, NativeFileShare)</h4>
<div class="markdown level1 summary"><p>Opens a text file, reads all lines of the file, and then closes the file.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">public static string ReadAllText(string path, Encoding encoding, NativeFileShare sharing = NativeFileShare.Read)</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Public Shared Function ReadAllText(path As String, encoding As Encoding, Optional sharing As NativeFileShare = NativeFileShare.Read) As String</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">path</span></td>
      <td><p>The file to open for reading.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.text.encoding">Encoding</a></td>
      <td><span class="parametername">encoding</span></td>
      <td><p>The encoding.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="C1.Util.DX.Storage.NativeFileShare.html">NativeFileShare</a></td>
      <td><span class="parametername">sharing</span></td>
      <td><p>The sharing.</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.string">string</a></td>
      <td><p>A string containing all lines of the file.</p>
</td>
    </tr>
  </tbody>
</table>
</div>
