ToBytes
Converts a file on a given path to a byte array.
Source
public static byte[] ToBytes(this string fileName)
{
if(!File.Exists(fileName))
throw new FileNotFoundException(fileName);
return File.ReadAllBytes(fileName);
}
Example
var bytes = @"C:\Temp\Products.pdf".ToBytes();