src/packages/EmbedIO.Testing/StockResource.cs
/// <summary>
/// Gets a resource as text.
/// </summary>
/// <param name="path">The path to the resource.</param>
/// <param name="encoding">The encoding to use to convert the resource's content
/// to a string. If <see langword="null"/> is specified (the default),
/// UTF-8 will be used.</param>
/// <returns>The specified resource as a <see langword="string"/>.</returns>
/// <exception cref="ArgumentNullException"><paramref name="path"/> is <see langword="null"/>.</exception>
/// <exception cref="ArgumentException"><paramref name="path"/> is an empty string.</exception>
/// <exception cref="FileNotFoundException"><paramref name="path"/> was not found.</exception>
Gets a resource as text.
Gets a resource as text .
public static string GetText(string path, Encoding? encoding = null)
        {
            using var stream = Open(path);
            using var reader = new StreamReader(stream, encoding ?? Encoding.UTF8, false, WebServer.StreamCopyBufferSize, true);
            return reader.ReadToEnd();
        }
public static string GetText ( string path , Encoding ? encoding = null ) { using var stream = Open ( path ) ; using var reader = new StreamReader ( stream , encoding ?? Encoding . UTF8 , false , WebServer . StreamCopyBufferSize , true ) ; return reader . ReadToEnd ( ) ; }
Gets a resource as text.
Gets a resource as text .
The specified resource as a .
The specified resource as a .
None
None
was not found.
was not found .
path
string
The path to the resource.
The path to the resource .
encoding
Encoding?
The encoding to use to convert the resource's content
to a string. If  is specified (the default),
UTF-8 will be used.
The encoding to use to convert the resource ' s content to a string . If is specified ( the default ) UTF - 8 will be used .