src/packages/EmbedIO.Testing/StockResource.cs
/// <summary>
/// Gets a resource as an array of bytes.
/// </summary>
/// <param name="path">The path to the resource.</param>
/// <returns>An array of bytes containing the resource's contents.</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 an array of bytes.
Gets a resource as an array of bytes .
public static byte[] GetBytes(string path)
        {
            using var stream = Open(path);
            var length = (int)stream.Length;
            if (length == 0)
                return Array.Empty<byte>();
            var buffer = new byte[length];
            stream.Read(buffer, 0, length);
            return buffer;
        }
public static byte [ ] GetBytes ( string path ) { using var stream = Open ( path ) ; var length = ( int ) stream . Length ; if ( length == 0 ) return Array . Empty < byte > ( ) ; var buffer = new byte [ length ] ; stream . Read ( buffer , 0 , length ) ; return buffer ; }
Gets a resource as an array of bytes.
Gets a resource as an array of bytes .
An array of bytes containing the resource's contents.
An array of bytes containing the resource ' s contents .
None
None
was not found.
was not found .
path
string
The path to the resource.
The path to the resource .